diff --git a/.gitignore b/.gitignore index 54a5d8203..2e0a455ed 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ vendor /samples/#* /samples/Github_*.* /samples/results +/composer.lock diff --git a/.travis.yml b/.travis.yml index 62310d2c1..dc2e11574 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: php php: @@ -17,13 +18,15 @@ env: global: - secure: "LtlUOzC8FtqgbqUTmU7EU281NSCb58UFdvnz8lelNIDltBdP4eayN/TsgNIePB4jXg2d2R56ZA6j/grhE/md6jdUkulV355H3GrH/hIZmmQ+F9+87agnwLzb9+MJbqXoiE7VvjY3zGIO09G897SUfsfu6JWEcscYFlsH6KcXM6M=" +addons: + apt: + packages: + - graphviz + before_script: - ## Packages - - sudo apt-get -qq update > /dev/null - - sudo apt-get -qq install graphviz > /dev/null ## Composer - composer self-update - - composer install --prefer-source --dev + - composer install --prefer-source ## PHPDocumentor - mkdir -p build/docs - mkdir -p build/coverage @@ -55,4 +58,4 @@ notifications: - 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 + on_start: false # default: false diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh index 487b0bbfe..a88b576e7 100644 --- a/.travis_shell_after_success.sh +++ b/.travis_shell_after_success.sh @@ -5,6 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" +##if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPPresentation" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPPowerPoint" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then echo -e "Publishing PHPDoc...\n" @@ -15,6 +16,7 @@ if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPPowerPoint" ] && [ "$TRAVIS_PULL_REQUE cd $HOME git config --global user.email "travis@travis-ci.org" git config --global user.name "travis-ci" + ## git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPPresentation gh-pages > /dev/null git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPPowerPoint gh-pages > /dev/null cd gh-pages diff --git a/CHANGELOG.md b/CHANGELOG.md index a5d1f3a52..91743ab13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,25 @@ # Changelog +## 0.5.0 - 2015-10-08 + +### Features +- PowerPoint2007 Reader : Initial Commit - @Progi1984 GH-44 +- ODPresentation Reader : Initial Commit - @Progi1984 GH-113 + +### Bugfix +- Fixed the sample in Readme.md - @Progi1984 GH-114 + +### Changes +- PhpOffice\PhpPowerpoint becomes PhpOffice\PhpPresentation - @Progi1984 GH-25 +- PhpOffice\PhpPowerpoint\Style\Font::setStriketrough has been removed : Use setStrikethrough - @Progi1984 +- PhpOffice\PhpPowerpoint\AbstractShape::getSlide has been removed - @Progi1984 +- PhpOffice\PhpPowerpoint\AbstractShape::setSlide has been removed - @Progi1984 +- PhpOffice\PhpPowerpoint\DocumentLayout::getLayoutXmilli has been removed : getCX(DocumentLayout::UNIT_MILLIMETER) - @Progi1984 +- PhpOffice\PhpPowerpoint\DocumentLayout::getLayoutYmilli has been removed : getCY(DocumentLayout::UNIT_MILLIMETER) - @Progi1984 +- PhpOffice\PhpPowerpoint\DocumentLayout::setLayoutXmilli has been removed : setCX(DocumentLayout::UNIT_MILLIMETER) - @Progi1984 +- PhpOffice\PhpPowerpoint\DocumentLayout::setLayoutYmilli has been removed : setCY(DocumentLayout::UNIT_MILLIMETER) - @Progi1984 +- Update the dependence PhpOffice\Common to 0.2.* - @Progi1984 +- Migrated Travis CI to legacy - @Progi1984 GH-115 + ## 0.4.0 - 2015-07-07 ### Features diff --git a/LICENSE b/LICENSE index f5d35b7e8..e67de5a2f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,15 +1,15 @@ -PHPPowerPoint, a pure PHP library for writing presentations files. +PHPPresentation, a pure PHP library for writing presentations files. -Copyright (c) 2010-2014 PHPPowerPoint. +Copyright (c) 2010-2015 PHPPresentation. -PHPPowerPoint is free software: you can redistribute it and/or modify +PHPPresentation is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation. -PHPPowerPoint is distributed in the hope that it will be useful, +PHPPresentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License version 3 for more details. You should have received a copy of the GNU Lesser General Public License version 3 -along with PHPPowerPoint. If not, see . +along with PHPPresentation. If not, see . diff --git a/README.md b/README.md index dd3ffe4d1..e8529f039 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ![PHPPowerPoint](https://github.com/PHPOffice/PHPPowerPoint/raw/master/docs/images/PHPPowerPointLogo.png "PHPPowerPoint") +# ![PHPPresentation](https://github.com/PHPOffice/PHPPresentation/raw/master/docs/images/PHPPowerPointLogo.png "PHPPresentation") [![Latest Stable Version](https://poser.pugx.org/phpoffice/phppowerpoint/v/stable.png)](https://packagist.org/packages/phpoffice/phppowerpoint) [![Build Status](https://travis-ci.org/PHPOffice/PHPPowerPoint.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPPowerPoint) @@ -9,20 +9,19 @@ [![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). +PHPPresentation 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). -PHPPowerPoint is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPPowerPoint/blob/develop/COPYING.LESSER). PHPPowerPoint is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPPowerPoint) and [unit testing](http://phpoffice.github.io/PHPPowerPoint/coverage/develop/). You can learn more about PHPPowerPoint by reading the [Developers' Documentation](http://phppowerpoint.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPPowerPoint/docs/develop/). +PHPPresentation is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPPresentation/blob/develop/COPYING.LESSER). PHPPresentation is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPPowerPoint) and [unit testing](http://phpoffice.github.io/PHPPresentation/coverage/develop/). You can learn more about PHPPresentation by reading the [Developers' Documentation](http://phppowerpoint.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPPresentation/docs/develop/). -Read more about PHPPowerPoint: +Read more about PHPPresentation: - [Features](#features) - [Requirements](#requirements) - [Installation](#installation) - [Getting started](#getting-started) -- [Known issues](#known-issues) - [Contributing](#contributing) - [Developers' Documentation](http://phppowerpoint.readthedocs.org/) -- [API Documentation](http://phpoffice.github.io/PHPPowerPoint/docs/master/) +- [API Documentation](http://phpoffice.github.io/PHPPresentation/docs/master/) ### Features @@ -40,7 +39,7 @@ Read more about PHPPowerPoint: ### Requirements -PHPPowerPoint requires the following: +PHPPresentation requires the following: - PHP 5.3+ - [Zip extension](http://php.net/manual/en/book.zip.php) @@ -49,42 +48,51 @@ PHPPowerPoint requires the following: ### Installation -It is recommended that you install the PHPPowerPoint library [through composer](http://getcomposer.org/). To do so, add +It is recommended that you install the PHPPresentation library [through composer](http://getcomposer.org/). To do so, add the following lines to your ``composer.json``. ```json { "require": { - "phpoffice/phppowerpoint": "dev-master" + "phpoffice/phppresentation": "dev-master" } } ``` -Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPPowerPoint/releases). +Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPPresentation/releases). In this case, you will have to register the autoloader. Register autoloading is required only if you do not use composer in your project. ```php -require_once 'path/to/PhpPowerpoint/src/PhpPowerpoint/Autoloader.php'; -\PhpOffice\PhpPowerpoint\Autoloader::register(); +require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; +\PhpOffice\PhpPresentation\Autoloader::register(); ``` ## Getting started -The following is a basic usage example of the PHPPowerPoint library. +The following is a basic usage example of the PHPPresentation library. ```php -require_once 'src/PhpPowerpoint/Autoloader.php'; -\PhpOffice\PhpPowerpoint\Autoloader::register(); +// with your own install +require_once 'src/PhpPresentation/Autoloader.php'; +\PhpOffice\PhpPresentation\Autoloader::register(); -$objPHPPowerPoint = new PhpPowerpoint(); +// with Composer +require_once 'vendor/autoload.php'; + +use PhpOffice\PhpPresentation\PhpPowerpoint; +use PhpOffice\PhpPresentation\IOFactory; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Alignment; + +$objPHPPowerPoint = new PhpPresentation(); // Create slide $currentSlide = $objPHPPowerPoint->getActiveSlide(); // Create a shape (drawing) $shape = $currentSlide->createDrawingShape(); -$shape->setName('PHPPowerPoint logo') - ->setDescription('PHPPowerPoint logo') +$shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -100,7 +108,7 @@ $shape = $currentSlide->createRichTextShape() ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); @@ -111,14 +119,14 @@ $oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation'); $oWriterODP->save(__DIR__ . "/sample.odp"); ``` -More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phppowerpoint.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPPowerPoint/docs/master/) for more detail. +More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phppowerpoint.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPPresentation/docs/master/) for more detail. ## Contributing -We welcome everyone to contribute to PHPPowerPoint. Below are some of the things that you can do to contribute: +We welcome everyone to contribute to PHPPresentation. Below are some of the things that you can do to contribute: -- Read [our contributing guide](https://github.com/PHPOffice/PHPPowerPoint/blob/master/CONTRIBUTING.md) -- [Fork us](https://github.com/PHPOffice/PHPPowerPoint/fork) and [request a pull](https://github.com/PHPOffice/PHPPowerPoint/pulls) to the [develop](https://github.com/PHPOffice/PHPPowerPoint/tree/develop) branch -- Submit [bug reports or feature requests](https://github.com/PHPOffice/PHPPowerPoint/issues) to GitHub +- Read [our contributing guide](https://github.com/PHPOffice/PHPPresentation/blob/master/CONTRIBUTING.md) +- [Fork us](https://github.com/PHPOffice/PHPPresentation/fork) and [request a pull](https://github.com/PHPOffice/PHPPresentation/pulls) to the [develop](https://github.com/PHPOffice/PHPPresentation/tree/develop) branch +- Submit [bug reports or feature requests](https://github.com/PHPOffice/PHPPresentation/issues) to GitHub - Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter diff --git a/composer.json b/composer.json index 6e156c85a..23a9b0d9f 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "phpoffice/phppowerpoint", - "description": "PHPPowerPoint - Read, Create and Write Presentations documents in PHP", + "name": "phpoffice/phppresentation", + "description": "PHPPresentation - Read, Create and Write Presentations documents in PHP", "keywords": ["PHP","PowerPoint","LibreOffice","pptx","ppt","odp","presentations"], "homepage": "http://phpoffice.github.io", "type": "library", @@ -22,7 +22,7 @@ "php": ">=5.3.0", "ext-xml": "*", "ext-zip": "*", - "phpoffice/common": "0.1.*" + "phpoffice/common": "0.2.*" }, "require-dev": { "phpunit/phpunit": "3.7.*", @@ -37,7 +37,7 @@ }, "autoload": { "psr-4": { - "PhpOffice\\PhpPowerpoint\\": "src/PhpPowerpoint/" + "PhpOffice\\PhpPresentation\\": "src/PhpPresentation/" } } } diff --git a/docs/conf.py b/docs/conf.py index 31a52a875..ffb127fe0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# PhpPowerpoint documentation build configuration file, created by +# PhpPresentation documentation build configuration file, created by # sphinx-quickstart on Fri Mar 14 23:09:26 2014. # # This file is execfile()d with the current directory set to its containing dir. @@ -40,8 +40,8 @@ master_doc = 'index' # General information about the project. -project = u'PhpPowerpoint' -copyright = u'2014, PHPPowerPoint Contributors' +project = 'PhpPresentation' +copyright = u'2014, PHPPresentation Contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -164,7 +164,7 @@ #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'PhpPowerpointdoc' +htmlhelp_basename = 'PhpPresentation' # -- Options for LaTeX output -------------------------------------------------- @@ -183,8 +183,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'PhpPowerpoint.tex', u'PhpPowerpoint Documentation', - u'The PhpPowerpoint Team', 'manual'), + ('index', 'PhpPresentation.tex', u'PhpPresentation Documentation', + u'The PhpPresentation Team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -213,8 +213,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'PhpPowerpoint', u'PhpPowerpoint Documentation', - [u'The PhpPowerpoint Team'], 1) + ('index', 'PhpPresentation', u'PhpPresentation Documentation', + [u'The PhpPresentation Team'], 1) ] # If true, show URL addresses after external links. @@ -227,8 +227,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'PhpPowerpoint', u'PhpPowerpoint Documentation', - u'The PhpPowerpoint Team', 'PhpPowerpoint', 'One line description of project.', + ('index', 'PhpPresentation', u'PhpPresentation Documentation', + u'The PhpPresentation Team', 'PhpPresentation', 'One line description of project.', 'Miscellaneous'), ] @@ -244,9 +244,9 @@ # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u'PhpPowerpoint' -epub_author = u'The PhpPowerpoint Team' -epub_publisher = u'The PhpPowerpoint Team' +epub_title = u'PhpPresentation' +epub_author = u'The PhpPresentation Team' +epub_publisher = u'The PhpPresentation Team' epub_copyright = copyright # The language of the text. It defaults to the language option diff --git a/docs/faq.rst b/docs/faq.rst index 0445d9da8..81b4bf895 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -11,13 +11,13 @@ find in PHPPowerPoint 0.1. The development in CodePlex is halted and 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? +I’ve been running PHPPowerPoint from CodePlex flawlessly, but I can’t use the latest PHPPresentation from GitHub. Why? -------------------------------------------------------------------------------------------------------------------- -PHPPowerPoint requires PHP 5.3+ since 0.2, while PHPPowerPoint 0.1 from CodePlex +PHPPresentation 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+. +version to use PHPPresentation 0.2+. Why am I getting a class not found error? ----------------------------------------- @@ -31,7 +31,7 @@ without having to specify the full class name in your code: .. code-block:: php - use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing as MemoryDrawing; + use PhpOffice\PhpPresentation\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 @@ -47,3 +47,8 @@ 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. + +Why PHPPowerPoint become PHPPresentation ? +------------------------------------------ +As `Roman Syroeshko noticed us `__, PowerPoint is a `trademark `__. +For avoiding any problems with Microsoft, we decide to change the name to a more logic name, with our panel of readers/writers. \ No newline at end of file diff --git a/docs/general.rst b/docs/general.rst index 71e61af8e..6cf0b5b54 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -6,25 +6,25 @@ General usage Basic example ------------- -The following is a basic example of the PHPPowerPoint library. More examples +The following is a basic example of the PHPPresentation library. More examples are provided in the `samples -folder `__. +folder `__. .. code-block:: php - require_once 'src/PhpPowerpoint/Autoloader.php'; - \PhpOffice\PhpPowerpoint\Autoloader::register(); + require_once 'src/PhpPresentation/Autoloader.php'; + \PhpOffice\PhpPresentation\Autoloader::register(); - $objPHPPowerPoint = new PhpPowerpoint(); + $objPHPPresentation = new PhpPresentation(); // Create slide - $currentSlide = $objPHPPowerPoint->getActiveSlide(); + $currentSlide = $objPHPPresentation->getActiveSlide(); // Create a shape (drawing) $shape = $currentSlide->createDrawingShape(); - $shape->setName('PHPPowerPoint logo') - ->setDescription('PHPPowerPoint logo') - ->setPath('./resources/phppowerpoint_logo.gif') + $shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') + ->setPath('./resources/phppresentation_logo.gif') ->setHeight(36) ->setOffsetX(10) ->setOffsetY(10); @@ -39,14 +39,14 @@ folder `__. ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); - $textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); + $textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); - $oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007'); + $oWriterPPTX = IOFactory::createWriter($objPHPPresentation, 'PowerPoint2007'); $oWriterPPTX->save(__DIR__ . "/sample.pptx"); - $oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation'); + $oWriterODP = IOFactory::createWriter($objPHPPresentation, 'ODPresentation'); $oWriterODP->save(__DIR__ . "/sample.odp"); Document information @@ -57,7 +57,7 @@ name. Use the following functions: .. code-block:: php - $properties = $phpPowerpoint->getProperties(); + $properties = $objPHPPresentation->getProperties(); $properties->setCreator('My name'); $properties->setCompany('My factory'); $properties->setTitle('My title'); diff --git a/docs/index.rst b/docs/index.rst index c59e73ac9..6a4465cf6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,14 +1,14 @@ -.. PHPPowerPoint documentation master file, created by +.. PHPPresentation documentation master file, created by sphinx-quickstart on Fri Mar 14 23:09:26 2014. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to PHPPowerPoint's documentation +Welcome to PHPPresentation's documentation ======================================== -|PHPPowerPoint| +|PHPPresentation| -PHPPowerPoint is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. OpenXML (.pptx) and OpenDocument (.odp). PHPPowerPoint is an open source project licensed under LGPL. +PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. OpenXML (.pptx) and OpenDocument (.odp). PHPPresentation is an open source project licensed under LGPL. .. toctree:: :maxdepth: 2 @@ -41,4 +41,4 @@ Indices and tables * :ref:`modindex` * :ref:`search` -.. |PHPPowerPoint| image:: images/phppowerpoint_logo.gif +.. |PHPPresentation| image:: images/phppowerpoint_logo.gif diff --git a/docs/installing.rst b/docs/installing.rst index df43955f2..9618828a8 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -21,7 +21,7 @@ Optional PHP extensions: Installation ------------ -There are two ways to install PHPPowerPoint, i.e. via +There are two ways to install PHPPresentation, i.e. via `Composer `__ or manually by downloading the library. @@ -35,28 +35,28 @@ To install via Composer, add the following lines to your { "require": { - "phpoffice/phppowerpoint": "dev-master" + "phpoffice/phppresentation": "dev-master" } } Manual install ~~~~~~~~~~~~~~ -To install manually, `download PHPPowerPoint package from -github `__. +To install manually, `download PHPPresentation package from +github `__. Extract the package and put the contents to your machine. To use the -library, include ``src/PhpPowerpoint/Autoloader.php`` in your script and +library, include ``src/PhpPresentation/Autoloader.php`` in your script and invoke ``Autoloader::register``. .. code-block:: php - require_once '/path/to/src/PhpPowerpoint/Autoloader.php'; - \PhpOffice\PhpPowerpoint\Autoloader::register(); + require_once '/path/to/src/PhpPresentation/Autoloader.php'; + \PhpOffice\PhpPresentation\Autoloader::register(); Using samples ------------- After installation, you can browse and use the samples that we've provided, either by command line or using browser. If you can access -your PHPPowerPoint library folder using browser, point your browser to the -``samples`` folder, e.g. ``http://localhost/PhpPowerpoint/samples/``. +your PHPPresentation library folder using browser, point your browser to the +``samples`` folder, e.g. ``http://localhost/PhpPresentation/samples/``. diff --git a/docs/intro.rst b/docs/intro.rst index 995ffdcef..1d01c9761 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -3,19 +3,19 @@ Introduction ============ -PHPPowerPoint is a library written in pure PHP that provides a set of +PHPPresentation 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 ` (.pptx) and OASIS `Open Document Format for Office Applications `__ (.odp). -PHPPowerPoint is an open source project licensed under the terms of `LGPL -version 3 `__. -PHPPowerPoint is aimed to be a high quality software product by incorporating -`continuous integration `__ and -`unit testing `__. -You can learn more about PHPPowerPoint by reading this Developers' -Documentation and the `API Documentation `__. +PHPPresentation is an open source project licensed under the terms of `LGPL +version 3 `__. +PHPPresentation is aimed to be a high quality software product by incorporating +`continuous integration `__ and +`unit testing `__. +You can learn more about PHPPresentation by reading this Developers' +Documentation and the `API Documentation `__. Features -------- @@ -48,7 +48,7 @@ Writers +---------------------------+----------------------+--------+-------+-------+-------+ | **Element Shape** | Image | ✓ | ✓ | | | +---------------------------+----------------------+--------+-------+-------+-------+ -| | Hyperlink | ✓ | | | | +| | Hyperlink | ✓ | ✓ | | | +---------------------------+----------------------+--------+-------+-------+-------+ | | Line | ✓ | ✓ | | | +---------------------------+----------------------+--------+-------+-------+-------+ @@ -74,19 +74,19 @@ Readers +---------------------------+----------------------+--------+-------+-------+-------+-------+ | Features | | PPTX | ODP | HTML | PDF | PPT | +===========================+======================+========+=======+=======+=======+=======+ -| **Document Properties** | Standard | | | | | | +| **Document Properties** | Standard | ✓ | ✓ | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | Custom | | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ -| **Element Shape** | Image | | | | | ✓ | +| **Element Shape** | Image | ✓ | ✓ | | | ✓ | +---------------------------+----------------------+--------+-------+-------+-------+-------+ -| | Hyperlink | | | | | ✓ | +| | Hyperlink | ✓ | ✓ | | | ✓ | +---------------------------+----------------------+--------+-------+-------+-------+-------+ -| | RichText | | | | | ✓ | +| | RichText | ✓ | ✓ | | | ✓ | +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | Table | | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ -| | Text | | | | | ✓ | +| | Text | ✓ | ✓ | | | ✓ | +---------------------------+----------------------+--------+-------+-------+-------+-------+ | **Charts** | Bar3D | | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ @@ -100,15 +100,15 @@ Readers Contributing ------------ -We welcome everyone to contribute to PHPPowerPoint. Below are some of the +We welcome everyone to contribute to PHPPresentation. Below are some of the things that you can do to contribute: - Read `our contributing - guide `__ -- `Fork us `__ and `request - a pull `__ to the - `develop `__ + guide `__ +- `Fork us `__ and `request + a pull `__ to the + `develop `__ branch - Submit `bug reports or feature - requests `__ to GitHub + requests `__ to GitHub - Follow `@PHPOffice `__ on Twitter diff --git a/docs/slides.rst b/docs/slides.rst index 4f244354d..9d7858730 100644 --- a/docs/slides.rst +++ b/docs/slides.rst @@ -3,4 +3,4 @@ Slides ====== -Slides are pages in a presentation. Slides are stored as a zero based array in ``PHPPowerPoint`` object. Use ``createSlide`` to create a new slide and retrieve the slide for other operation such as creating shapes for that slide. +Slides are pages in a presentation. Slides are stored as a zero based array in ``PHPPresentation`` object. Use ``createSlide`` to create a new slide and retrieve the slide for other operation such as creating shapes for that slide. diff --git a/phpmd.xml.dist b/phpmd.xml.dist index 87a53c279..33179ad87 100644 --- a/phpmd.xml.dist +++ b/phpmd.xml.dist @@ -1,5 +1,5 @@ - - - ./tests/PhpPowerpoint + + ./tests/PhpPresentation diff --git a/samples/Sample_X2_Presentation.php b/samples/Sample_01_Complex.php similarity index 84% rename from samples/Sample_X2_Presentation.php rename to samples/Sample_01_Complex.php index b8f252933..a5b0b7fa8 100644 --- a/samples/Sample_X2_Presentation.php +++ b/samples/Sample_01_Complex.php @@ -1,22 +1,22 @@ getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 02 Title') ->setSubject('Sample 02 Subject') ->setDescription('Sample 02 Description') @@ -25,11 +25,11 @@ // Remove first slide echo date('H:i:s') . ' Remove first slide'.EOL; -$objPHPPowerPoint->removeSlideByIndex(0); +$objPHPPresentation->removeSlideByIndex(0); // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function +$currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -47,7 +47,7 @@ $shape->createBreak(); -$textRun = $shape->createTextRun('PHPPowerPoint'); +$textRun = $shape->createTextRun('PHPPresentation'); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(60); $textRun->getFont()->setColor($colorBlack); @@ -55,7 +55,7 @@ // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function +$currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -66,7 +66,7 @@ ->setOffsetY(50); $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); -$textRun = $shape->createTextRun('What is PHPPowerPoint?'); +$textRun = $shape->createTextRun('What is PHPPresentation?'); $textRun->getFont()->setBold(true) ->setSize(48) ->setColor($colorBlack); @@ -93,7 +93,7 @@ // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function +$currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -138,14 +138,14 @@ $shape->createParagraph()->getAlignment()->setLevel(1) ->setMarginLeft(75) ->setIndent(-25); -$shape->createTextRun('PowerPoint 2007'); +$shape->createTextRun('PHPPresentation 2007'); $shape->createParagraph()->createTextRun('Serialized'); $shape->createParagraph()->createTextRun('... (more to come) ...'); // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function +$currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -176,14 +176,14 @@ $shape->createBreak(); -$textRun = $shape->createTextRun('https://github.com/PHPOffice/PHPPowerPoint/'); +$textRun = $shape->createTextRun('https://github.com/PHPOffice/PHPPresentation/'); $textRun->getFont()->setSize(32) ->setColor($colorBlack); -$textRun->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/') - ->setTooltip('PHPPowerPoint'); +$textRun->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/') + ->setTooltip('PHPPresentation'); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_01_Simple.php b/samples/Sample_01_Simple.php index bc6440ce1..c99bb867b 100644 --- a/samples/Sample_01_Simple.php +++ b/samples/Sample_01_Simple.php @@ -2,18 +2,18 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 01 Title') ->setSubject('Sample 01 Subject') ->setDescription('Sample 01 Description') @@ -22,13 +22,13 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentSlide = $objPHPPowerPoint->getActiveSlide(); +$currentSlide = $objPHPPresentation->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') +$shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -36,7 +36,7 @@ $shape->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); -$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation'); // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -46,13 +46,13 @@ ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_02_Serialized.php b/samples/Sample_02_Serialized.php index e3ffbb6df..1d9b3b60e 100644 --- a/samples/Sample_02_Serialized.php +++ b/samples/Sample_02_Serialized.php @@ -2,19 +2,19 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\IOFactory; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\IOFactory; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 03 Title') ->setSubject('Sample 03 Subject') ->setDescription('Sample 03 Description') @@ -23,13 +23,13 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentSlide = $objPHPPowerPoint->getActiveSlide(); +$currentSlide = $objPHPPresentation->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') +$shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -46,7 +46,7 @@ ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); @@ -54,15 +54,15 @@ // Save serialized file $basename = basename(__FILE__, '.php'); echo date('H:i:s') . ' Write to serialized format'.EOL; -$objWriter = IOFactory::createWriter($objPHPPowerPoint, 'Serialized'); +$objWriter = IOFactory::createWriter($objPHPPresentation, 'Serialized'); $objWriter->save('results/'.basename(__FILE__, '.php').'.phppt'); // Read from serialized file echo date('H:i:s') . ' Read from serialized format'.EOL; -$objPHPPowerPointLoaded = IOFactory::load('results/'.basename(__FILE__, '.php').'.phppt'); +$objPHPPresentationLoaded = IOFactory::load('results/'.basename(__FILE__, '.php').'.phppt'); // Save file -echo write($objPHPPowerPointLoaded, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentationLoaded, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_03_Image.php b/samples/Sample_03_Image.php index 0b00ed0fc..964a25095 100644 --- a/samples/Sample_03_Image.php +++ b/samples/Sample_03_Image.php @@ -2,26 +2,26 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shape\Drawing; -use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Shape\Drawing; +use PhpOffice\PhpPresentation\Shape\MemoryDrawing; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; +$objPHPPresentation = new PhpPresentation(); // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentSlide = $objPHPPowerPoint->getActiveSlide(); +$currentSlide = $objPHPPresentation->getActiveSlide(); // Generate an image echo date('H:i:s') . ' Generate an image'.EOL; $gdImage = @imagecreatetruecolor(140, 20) or die('Cannot Initialize new GD image stream'); $textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PHPPowerPoint', $textColor); +imagestring($gdImage, 1, 5, 5, 'Created with PHPPresentation', $textColor); // Add a generated drawing to the slide -echo date('H:i:s') . ' Add a drawing to the worksheet'.EOL; +echo date('H:i:s') . ' Add a drawing to the slide'.EOL; $shape = new MemoryDrawing(); $shape->setName('Sample image') ->setDescription('Sample image') @@ -35,8 +35,8 @@ // Add a file drawing (GIF) to the slide $shape = new Drawing(); -$shape->setName('PHPPowerPoint logo') - ->setDescription('PHPPowerPoint logo') +$shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -44,7 +44,7 @@ $currentSlide->addShape($shape); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_04_Table.php b/samples/Sample_04_Table.php index f1b3c5b24..4aa2fa2e5 100644 --- a/samples/Sample_04_Table.php +++ b/samples/Sample_04_Table.php @@ -2,19 +2,19 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Border; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Border; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 06 Title') ->setSubject('Sample 06 Subject') ->setDescription('Sample 06 Description') @@ -23,11 +23,11 @@ // Remove first slide echo date('H:i:s') . ' Remove first slide'.EOL; -$objPHPPowerPoint->removeSlideByIndex(0); +$objPHPPresentation->removeSlideByIndex(0); // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); +$currentSlide = createTemplatedSlide($objPHPPresentation); // Create a shape (table) echo date('H:i:s') . ' Create a shape (table)'.EOL; @@ -97,7 +97,7 @@ ->setEndColor(new Color('FFE06B20')); $cellC1 = $row->nextCell(); $textRunC1 = $cellC1->createTextRun('Link'); -$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation'); $cellC2 = $row->nextCell(); $textRunC2 = $cellC2->createTextRun('RichText with'); $textRunC2->getFont()->setBold(true); @@ -116,7 +116,7 @@ $textRunC3->getHyperlink()->setUrl('https://google.com')->setTooltip('Google'); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } \ No newline at end of file diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index 5ca0bb950..cb3547b11 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -2,23 +2,23 @@ include_once 'Sample_Header.php'; -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\Pie; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; -use PhpOffice\PhpPowerpoint\Shape\Chart\Series; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Border; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Style\Shadow; -use PhpOffice\PhpPowerpoint\Style\PhpOffice\PhpPowerpoint\Style; - -function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Area; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Line; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter; +use PhpOffice\PhpPresentation\Shape\Chart\Series; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Border; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; +use PhpOffice\PhpPresentation\Style\Shadow; +use PhpOffice\PhpPresentation\Style\PhpOffice\PhpPresentation\Style; + +function fnSlide_Area(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; @@ -36,7 +36,7 @@ function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // 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; @@ -51,11 +51,11 @@ function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { 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->setName('PHPPresentation 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()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($areaChart); $shape->getView3D()->setRotationX(30); @@ -64,13 +64,13 @@ function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_Bar(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Generate sample data for first chart echo date('H:i:s') . ' Generate sample data for chart'.EOL; @@ -95,7 +95,7 @@ function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Monthly Downloads') + $shape->setName('PHPPresentation Monthly Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -104,7 +104,7 @@ function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->setText('PHPPresentation Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); $shape->getPlotArea()->getAxisX()->setTitle('Month'); @@ -114,23 +114,23 @@ function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_BarHorizontal(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation) { 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 = clone $objPHPPresentation->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); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Monthly Downloads') + $shape->setName('PHPPresentation Monthly Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -139,7 +139,7 @@ function fnSlide_BarHorizontal(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->setText('PHPPresentation Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); $shape->getPlotArea()->getAxisX()->setTitle('Month'); @@ -149,13 +149,13 @@ function fnSlide_BarHorizontal(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_BarStacked(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_BarStacked(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL . date( 'H:i:s' ) . ' Create templated slide' . EOL; - $currentSlide = createTemplatedSlide( $objPHPPowerPoint ); + $currentSlide = createTemplatedSlide( $objPHPPresentation ); // Generate sample data for first chart echo date( 'H:i:s' ) . ' Generate sample data for chart' . EOL; @@ -191,7 +191,7 @@ function fnSlide_BarStacked(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date( 'H:i:s' ) . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); - $shape->setName( 'PHPPowerPoint Monthly Downloads' ) + $shape->setName( 'PHPPresentation Monthly Downloads' ) ->setResizeProportional( false ) ->setHeight( 550 ) ->setWidth( 700 ) @@ -200,7 +200,7 @@ function fnSlide_BarStacked(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow( $oShadow ); $shape->setFill( $oFill ); $shape->getBorder()->setLineStyle( Border::LINE_SINGLE ); - $shape->getTitle()->setText( 'PHPPowerPoint Monthly Downloads' ); + $shape->getTitle()->setText( 'PHPPresentation Monthly Downloads' ); $shape->getTitle()->getFont()->setItalic( true ); $shape->getTitle()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_RIGHT ); $shape->getPlotArea()->getAxisX()->setTitle( 'Month' ); @@ -209,13 +209,13 @@ function fnSlide_BarStacked(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getBorder()->setLineStyle( Border::LINE_SINGLE ); $shape->getLegend()->getFont()->setItalic( true ); } -function fnSlide_BarPercentStacked(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_BarPercentStacked(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL . date( 'H:i:s' ) . ' Create templated slide' . EOL; - $currentSlide = createTemplatedSlide( $objPHPPowerPoint ); + $currentSlide = createTemplatedSlide( $objPHPPresentation ); // Generate sample data for first chart echo date( 'H:i:s' ) . ' Generate sample data for chart' . EOL; @@ -268,7 +268,7 @@ function fnSlide_BarPercentStacked(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date( 'H:i:s' ) . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); - $shape->setName( 'PHPPowerPoint Monthly Downloads' ) + $shape->setName( 'PHPPresentation Monthly Downloads' ) ->setResizeProportional( false ) ->setHeight( 550 ) ->setWidth( 700 ) @@ -277,7 +277,7 @@ function fnSlide_BarPercentStacked(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow( $oShadow ); $shape->setFill( $oFill ); $shape->getBorder()->setLineStyle( Border::LINE_SINGLE ); - $shape->getTitle()->setText( 'PHPPowerPoint Monthly Downloads' ); + $shape->getTitle()->setText( 'PHPPresentation Monthly Downloads' ); $shape->getTitle()->getFont()->setItalic( true ); $shape->getTitle()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_RIGHT ); $shape->getPlotArea()->getAxisX()->setTitle( 'Month' ); @@ -287,13 +287,13 @@ function fnSlide_BarPercentStacked(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic( true ); } -function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_Bar3D(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Generate sample data for first chart echo date('H:i:s') . ' Generate sample data for chart'.EOL; @@ -318,7 +318,7 @@ function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Monthly Downloads') + $shape->setName('PHPPresentation Monthly Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -327,7 +327,7 @@ function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->setText('PHPPresentation Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); $shape->getPlotArea()->getAxisX()->setTitle('Month'); @@ -340,23 +340,23 @@ function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_Bar3DHorizontal(PhpPresentation $objPHPPresentation) { 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 = clone $objPHPPowerPoint->getSlide(5)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); + $bar3DChartHorz = clone $objPHPPresentation->getSlide(5)->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); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Monthly Downloads') + $shape->setName('PHPPresentation Monthly Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -365,7 +365,7 @@ function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->setText('PHPPresentation Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); $shape->getPlotArea()->getAxisX()->setTitle('Month'); @@ -378,13 +378,13 @@ function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_Pie3D(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for chart'.EOL; @@ -408,7 +408,7 @@ function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Daily Downloads') + $shape->setName('PHPPresentation Daily Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -417,7 +417,7 @@ function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($pie3DChart); $shape->getView3D()->setRotationX(30); @@ -426,13 +426,13 @@ function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Pie(PhpPowerpoint $objPHPPowerPoint) { +function fnSlide_Pie(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for chart'.EOL; @@ -459,7 +459,7 @@ function fnSlide_Pie(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Daily Downloads') + $shape->setName('PHPPresentation Daily Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -468,20 +468,20 @@ function fnSlide_Pie(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->setText('PHPPresentation 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) { +function fnSlide_Scatter(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function + $currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Generate sample data for fourth chart echo date('H:i:s') . ' Generate sample data for chart'.EOL; @@ -497,7 +497,7 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Daily Download Distribution') + $shape->setName('PHPPresentation Daily Download Distribution') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -506,7 +506,7 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($lineChart); $shape->getView3D()->setRotationX(30); @@ -515,14 +515,14 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 07 Title') ->setSubject('Sample 07 Subject') ->setDescription('Sample 07 Description') @@ -531,7 +531,7 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { // Remove first slide echo date('H:i:s') . ' Remove first slide'.EOL; -$objPHPPowerPoint->removeSlideByIndex(0); +$objPHPPresentation->removeSlideByIndex(0); // Set Style $oFill = new Fill(); @@ -540,28 +540,28 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { $oShadow = new Shadow(); $oShadow->setVisible(true)->setDirection(45)->setDistance(10); -fnSlide_Area($objPHPPowerPoint); +fnSlide_Area($objPHPPresentation); -fnSlide_Bar($objPHPPowerPoint); +fnSlide_Bar($objPHPPresentation); -fnSlide_BarStacked($objPHPPowerPoint); +fnSlide_BarStacked($objPHPPresentation); -fnSlide_BarPercentStacked($objPHPPowerPoint); +fnSlide_BarPercentStacked($objPHPPresentation); -fnSlide_BarHorizontal($objPHPPowerPoint); +fnSlide_BarHorizontal($objPHPPresentation); -fnSlide_Bar3D($objPHPPowerPoint); +fnSlide_Bar3D($objPHPPresentation); -fnSlide_Bar3DHorizontal($objPHPPowerPoint); +fnSlide_Bar3DHorizontal($objPHPPresentation); -fnSlide_Pie3D($objPHPPowerPoint); +fnSlide_Pie3D($objPHPPresentation); -fnSlide_Pie($objPHPPowerPoint); +fnSlide_Pie($objPHPPresentation); -fnSlide_Scatter($objPHPPowerPoint); +fnSlide_Scatter($objPHPPresentation); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_05_Chart_Line.php b/samples/Sample_05_Chart_Line.php index 66eae16ae..e249d69c2 100644 --- a/samples/Sample_05_Chart_Line.php +++ b/samples/Sample_05_Chart_Line.php @@ -2,29 +2,29 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; -use PhpOffice\PhpPowerpoint\Shape\Chart\Series; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Border; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Style\Shadow; - -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Line; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter; +use PhpOffice\PhpPresentation\Shape\Chart\Series; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Border; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; +use PhpOffice\PhpPresentation\Style\Shadow; + +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // 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'); +$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation 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); +$objPHPPresentation->removeSlideByIndex(0); // Set Style $oFill = new Fill(); @@ -47,7 +47,7 @@ // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); +$currentSlide = createTemplatedSlide($objPHPPresentation); // 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; @@ -60,11 +60,11 @@ // 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->setName('PHPPresentation 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()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($lineChart); $shape->getView3D()->setRotationX(30); @@ -74,7 +74,7 @@ // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); +$currentSlide = createTemplatedSlide($objPHPPresentation); // 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; @@ -85,15 +85,15 @@ 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->setName('PHPPresentation Weekly Downloads'); +$shape1->getTitle()->setText('PHPPresentation Weekly Downloads'); $shape1->getPlotArea()->setType($lineChart1); $shape1->getPlotArea()->getAxisY()->setFormatCode('#,##0'); $currentSlide->addShape($shape1); // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); +$currentSlide = createTemplatedSlide($objPHPPresentation); // 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; @@ -107,14 +107,14 @@ 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->setName('PHPPresentation Weekly Downloads'); +$shape2->getTitle()->setText('PHPPresentation 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($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; diff --git a/samples/Sample_05_Chart_with_PHPExcel.php b/samples/Sample_05_Chart_with_PHPExcel.php index bb56ab5ba..0968fa26a 100644 --- a/samples/Sample_05_Chart_with_PHPExcel.php +++ b/samples/Sample_05_Chart_with_PHPExcel.php @@ -2,25 +2,25 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; -use PhpOffice\PhpPowerpoint\Shape\Chart\Series; -use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Border; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D; +use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D; +use PhpOffice\PhpPresentation\Shape\Chart\Series; +use PhpOffice\PhpPresentation\Style\Fill; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Border; if (!class_exists('PHPExcel')) { echo('PHPExcel has not been loaded. Include PHPExcel.php in your script, e.g. require_once \'PHPExcel.php\'.'); } else { - // Create new PHPPowerPoint object - echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; - $objPHPPowerPoint = new PhpPowerpoint(); + // Create new PHPPresentation object + echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; + $objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; - $objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') + $objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 08 Title') ->setSubject('Sample 08 Subject') ->setDescription('Sample 08 Description') @@ -29,11 +29,11 @@ // Remove first slide echo date('H:i:s') . ' Remove first slide'.EOL; - $objPHPPowerPoint->removeSlideByIndex(0); + $objPHPPresentation->removeSlideByIndex(0); // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function + $currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Generate sample data for first chart echo date('H:i:s') . ' Generate sample data for first chart'.EOL; @@ -49,7 +49,7 @@ // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Monthly Downloads') + $shape->setName('PHPPresentation Monthly Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -64,7 +64,7 @@ ->setEndColor(new Color('FFFFFFFF')) ->setRotation(270); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->setText('PHPPresentation Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->getAxisX()->setTitle('Month'); $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); @@ -77,7 +77,7 @@ // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function + $currentSlide = createTemplatedSlide($objPHPPresentation); // local function // Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for second chart'.EOL; @@ -91,7 +91,7 @@ // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); - $shape->setName('PHPPowerPoint Daily Downloads') + $shape->setName('PHPPresentation Daily Downloads') ->setResizeProportional(false) ->setHeight(550) ->setWidth(700) @@ -106,7 +106,7 @@ ->setEndColor(new Color('FFFFFFFF')) ->setRotation(270); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); - $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($pie3DChart); $shape->getView3D()->setRotationX(30); @@ -115,7 +115,7 @@ $shape->getLegend()->getFont()->setItalic(true); // Save file - echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); + echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); } if (!CLI) { include_once 'Sample_Footer.php'; diff --git a/samples/Sample_06_Fill.php b/samples/Sample_06_Fill.php index f4322e209..906c6916c 100644 --- a/samples/Sample_06_Fill.php +++ b/samples/Sample_06_Fill.php @@ -2,19 +2,19 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 01 Title') ->setSubject('Sample 01 Subject') ->setDescription('Sample 01 Description') @@ -23,7 +23,7 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentSlide = $objPHPPowerPoint->getActiveSlide(); +$currentSlide = $objPHPPresentation->getActiveSlide(); for($inc = 1 ; $inc <= 4 ; $inc++){ @@ -59,14 +59,14 @@ break; } - $textRun = $shape->createTextRun('Use PHPPowerPoint!'); + $textRun = $shape->createTextRun('Use PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(30) ->setColor( new Color('FFE06B20') ); } // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_07_Border.php b/samples/Sample_07_Border.php index e1648a8f4..a6ec67803 100644 --- a/samples/Sample_07_Border.php +++ b/samples/Sample_07_Border.php @@ -2,23 +2,23 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Style\Border; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; +use PhpOffice\PhpPresentation\Style\Border; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties' . EOL; -$objPHPPowerPoint->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'); +$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation 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(); +$currentSlide = $objPHPPresentation->getActiveSlide(); for ($inc = 1; $inc <= 4; $inc++) { @@ -52,12 +52,12 @@ break; } - $textRun = $shape->createTextRun('Use PHPPowerPoint!'); + $textRun = $shape->createTextRun('Use PHPPresentation!'); $textRun->getFont()->setBold(true)->setSize(30)->setColor(new Color('FFE06B20')); } // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_08_Group.php b/samples/Sample_08_Group.php index fd75ed7b0..3f4e6e80d 100644 --- a/samples/Sample_08_Group.php +++ b/samples/Sample_08_Group.php @@ -2,18 +2,18 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 01 Title') ->setSubject('Sample 01 Subject') ->setDescription('Sample 01 Description') @@ -22,13 +22,13 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$currentGroup = $objPHPPowerPoint->getActiveSlide()->createGroup(); +$currentGroup = $objPHPPresentation->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') +$shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -45,13 +45,13 @@ ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_09_SlideNote.php b/samples/Sample_09_SlideNote.php index 152d92d6a..b17537f43 100644 --- a/samples/Sample_09_SlideNote.php +++ b/samples/Sample_09_SlideNote.php @@ -2,29 +2,29 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Style\Border; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Style\Fill; +use PhpOffice\PhpPresentation\Style\Border; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties' . EOL; -$objPHPPowerPoint->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'); +$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation 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(); +$currentSlide = $objPHPPresentation->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') +$shape->setName('PHPPresentation logo') +->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -32,7 +32,7 @@ $shape->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); -$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation'); // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -42,7 +42,7 @@ ->setOffsetX(170) ->setOffsetY(180); $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shape->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); @@ -57,7 +57,7 @@ $oRichText->createParagraph()->createTextRun('Supports writing to different file formats'); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_10_Transition.php b/samples/Sample_10_Transition.php index ed1106ef5..b9791406b 100644 --- a/samples/Sample_10_Transition.php +++ b/samples/Sample_10_Transition.php @@ -2,19 +2,19 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Slide\Transition; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Slide\Transition; -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object' . EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') +$objPHPPresentation->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 10 Title') ->setSubject('Sample 10 Subject') ->setDescription('Sample 10 Description') @@ -23,13 +23,13 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$slide0 = $objPHPPowerPoint->getActiveSlide(); +$slide0 = $objPHPPresentation->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') +$shapeDrawing->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) @@ -37,7 +37,7 @@ $shapeDrawing->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); -$shapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$shapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation'); // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; @@ -47,7 +47,7 @@ ->setOffsetX(170) ->setOffsetY(180); $shapeRichText->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); -$textRun = $shapeRichText->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun = $shapeRichText->createTextRun('Thank you for using PHPPresentation!'); $textRun->getFont()->setBold(true) ->setSize(60) ->setColor( new Color( 'FFE06B20' ) ); @@ -60,12 +60,12 @@ // Create slide echo date('H:i:s') . ' Create slide'.EOL; -$slide1 = $objPHPPowerPoint->createSlide(); +$slide1 = $objPHPPresentation->createSlide(); $slide1->addShape(clone $shapeDrawing); $slide1->addShape(clone $shapeRichText); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_11_Shape.php b/samples/Sample_11_Shape.php index 36a17791d..b6ab9f58c 100644 --- a/samples/Sample_11_Shape.php +++ b/samples/Sample_11_Shape.php @@ -1,16 +1,16 @@ getFont()->setColor(new Color( 'FF000000' )); } -function fnSlideRichTextShadow(PhpPowerpoint $objPHPPowerPoint) { +function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation) { // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; - $currentSlide = createTemplatedSlide($objPHPPowerPoint); + $currentSlide = createTemplatedSlide($objPHPPresentation); // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text) with shadow'.EOL; @@ -53,15 +53,15 @@ function fnSlideRichTextShadow(PhpPowerpoint $objPHPPowerPoint) { $textRun->getFont()->setColor(new Color( 'FF000000' )); } -// Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; -$objPHPPowerPoint = new PhpPowerpoint(); +// Create new PHPPresentation object +echo date('H:i:s') . ' Create new PHPPresentation object'.EOL; +$objPHPPresentation = new PhpPresentation(); // Set properties echo date('H:i:s') . ' Set properties'.EOL; -$oProperties = $objPHPPowerPoint->getProperties(); +$oProperties = $objPHPPresentation->getProperties(); $oProperties->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') + ->setLastModifiedBy('PHPPresentation Team') ->setTitle('Sample 11 Title') ->setSubject('Sample 11 Subject') ->setDescription('Sample 11 Description') @@ -70,13 +70,13 @@ function fnSlideRichTextShadow(PhpPowerpoint $objPHPPowerPoint) { // Remove first slide echo date('H:i:s') . ' Remove first slide'.EOL; -$objPHPPowerPoint->removeSlideByIndex(0); +$objPHPPresentation->removeSlideByIndex(0); -fnSlideRichText($objPHPPowerPoint); -fnSlideRichTextShadow($objPHPPowerPoint); +fnSlideRichText($objPHPPresentation); +fnSlideRichTextShadow($objPHPPresentation); // Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_12_Reader_ODPresentation.php b/samples/Sample_12_Reader_ODPresentation.php new file mode 100644 index 000000000..e66502187 --- /dev/null +++ b/samples/Sample_12_Reader_ODPresentation.php @@ -0,0 +1,25 @@ +load('resources/Sample_12.odp'); + +$oTree = new PhpPptTree($oPHPPresentation); +echo $oTree->display(); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_12_Reader_PowerPoint2007.php b/samples/Sample_12_Reader_PowerPoint2007.php new file mode 100644 index 000000000..074f0fad5 --- /dev/null +++ b/samples/Sample_12_Reader_PowerPoint2007.php @@ -0,0 +1,25 @@ +load('resources/Sample_12.pptx'); + +$oTree = new PhpPptTree($oPHPPresentation); +echo $oTree->display(); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_12_Reader_PowerPoint97.php b/samples/Sample_12_Reader_PowerPoint97.php index cec570d8f..9db9f458c 100644 --- a/samples/Sample_12_Reader_PowerPoint97.php +++ b/samples/Sample_12_Reader_PowerPoint97.php @@ -4,168 +4,21 @@ include_once 'Sample_Header.php'; -use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\DocumentLayout; -use PhpOffice\PhpPowerpoint\IOFactory; -use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Slide; -use PhpOffice\PhpPowerpoint\AbstractShape; -use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; -use PhpOffice\PhpPowerpoint\Shape\RichText; -use PhpOffice\PhpPowerPoint\Shape\Group; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\DocumentLayout; +use PhpOffice\PhpPresentation\IOFactory; +use PhpOffice\PhpPresentation\Style\Alignment; +use PhpOffice\PhpPresentation\Style\Color; +use PhpOffice\PhpPresentation\Slide; +use PhpOffice\PhpPresentation\AbstractShape; +use PhpOffice\PhpPresentation\Shape\MemoryDrawing; +use PhpOffice\PhpPresentation\Shape\RichText; +use PhpOffice\PhpPresentation\Shape\Group; -class PhpPptTree { - protected $oPhpPowerpoint; - protected $htmlOutput; - - public function __construct(PhpPowerpoint $oPHPPpt) - { - $this->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'); +$pptReader = PhpOffice\PhpPresentation\IOFactory::createReader('PowerPoint97'); +$oPHPPresentation = $pptReader->load('resources/Sample_12.ppt'); -$oTree = new PhpPptTree($oPHPPowerPoint); +$oTree = new PhpPptTree($oPHPPresentation); echo $oTree->display(); if (!CLI) { include_once 'Sample_Footer.php'; diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index b85f26ab3..2025141c4 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -2,10 +2,19 @@ /** * Header file */ -use PhpOffice\PhpPowerpoint\Autoloader; -use PhpOffice\PhpPowerpoint\Settings; -use PhpOffice\PhpPowerpoint\IOFactory; -use PhpOffice\PhpPowerpoint\Slide; +use PhpOffice\PhpPresentation\Autoloader; +use PhpOffice\PhpPresentation\Settings; +use PhpOffice\PhpPresentation\IOFactory; +use PhpOffice\PhpPresentation\Slide; +use PhpOffice\PhpPresentation\PhpPresentation; +use PhpOffice\PhpPresentation\AbstractShape; +use PhpOffice\PhpPresentation\DocumentLayout; +use PhpOffice\PhpPresentation\Shape\Drawing; +use PhpOffice\PhpPresentation\Shape\MemoryDrawing; +use PhpOffice\PhpPresentation\Shape\RichText; +use PhpOffice\PhpPresentation\Shape\RichText\BreakElement; +use PhpOffice\PhpPresentation\Shape\RichText\TextElement; +use PhpOffice\PhpPresentation\Style\Bullet; error_reporting(E_ALL); define('CLI', (PHP_SAPI == 'cli') ? true : false); @@ -13,7 +22,7 @@ define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php')); define('IS_INDEX', SCRIPT_FILENAME == 'index'); -require_once __DIR__ . '/../src/PhpPowerpoint/Autoloader.php'; +require_once __DIR__ . '/../src/PhpPresentation/Autoloader.php'; Autoloader::register(); require_once __DIR__ . '/../vendor/autoload.php'; @@ -23,54 +32,54 @@ // Return to the caller script when runs by CLI if (CLI) { - return; + return; } // Set titles and names $pageHeading = str_replace('_', ' ', SCRIPT_FILENAME); $pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - "; -$pageTitle .= 'PHPPowerPoint'; +$pageTitle .= 'PHPPresentation'; $pageHeading = IS_INDEX ? '' : "

    {$pageHeading}

    "; // Populate samples $files = ''; if ($handle = opendir('.')) { - while (false !== ($file = readdir($handle))) { - if (preg_match('/^Sample_\d+_/', $file)) { - $name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file)); - $files .= "
  • {$name}
  • "; - } - } - closedir($handle); + while (false !== ($file = readdir($handle))) { + if (preg_match('/^Sample_\d+_/', $file)) { + $name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file)); + $files .= "
  • {$name}
  • "; + } + } + closedir($handle); } /** * Write documents * - * @param \PhpOffice\PhpPowerPoint\PhpPowerPoint $phpPowerPoint + * @param \PhpOffice\PhpPresentation\PhpPresentation $phpPresentation * @param string $filename * @param array $writers */ -function write($phpPowerPoint, $filename, $writers) +function write($phpPresentation, $filename, $writers) { - $result = ''; - - // Write documents - foreach ($writers as $writer => $extension) { - $result .= date('H:i:s') . " Write to {$writer} format"; - if (!is_null($extension)) { - $xmlWriter = IOFactory::createWriter($phpPowerPoint, $writer); - $xmlWriter->save(__DIR__ . "/{$filename}.{$extension}"); - rename(__DIR__ . "/{$filename}.{$extension}", __DIR__ . "/results/{$filename}.{$extension}"); - } else { - $result .= ' ... NOT DONE!'; - } - $result .= EOL; - } - - $result .= getEndingNotes($writers); - - return $result; + $result = ''; + + // Write documents + foreach ($writers as $writer => $extension) { + $result .= date('H:i:s') . " Write to {$writer} format"; + if (!is_null($extension)) { + $xmlWriter = IOFactory::createWriter($phpPresentation, $writer); + $xmlWriter->save(__DIR__ . "/{$filename}.{$extension}"); + rename(__DIR__ . "/{$filename}.{$extension}", __DIR__ . "/results/{$filename}.{$extension}"); + } else { + $result .= ' ... NOT DONE!'; + } + $result .= EOL; + } + + $result .= getEndingNotes($writers); + + return $result; } /** @@ -80,62 +89,289 @@ function write($phpPowerPoint, $filename, $writers) */ function getEndingNotes($writers) { - $result = ''; - - // Do not show execution time for index - if (!IS_INDEX) { - $result .= date('H:i:s') . " Done writing file(s)" . EOL; - $result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL; - } - - // Return - if (CLI) { - $result .= 'The results are stored in the "results" subdirectory.' . EOL; - } else { - if (!IS_INDEX) { - $types = array_values($writers); - $result .= '

     

    '; - $result .= '

    Results: '; - foreach ($types as $type) { - if (!is_null($type)) { - $resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type; - if (file_exists($resultFile)) { - $result .= "{$type} "; - } - } - } - $result .= '

    '; - } - } - - return $result; + $result = ''; + + // Do not show execution time for index + if (!IS_INDEX) { + $result .= date('H:i:s') . " Done writing file(s)" . EOL; + $result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL; + } + + // Return + if (CLI) { + $result .= 'The results are stored in the "results" subdirectory.' . EOL; + } else { + if (!IS_INDEX) { + $types = array_values($writers); + $result .= '

     

    '; + $result .= '

    Results: '; + foreach ($types as $type) { + if (!is_null($type)) { + $resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type; + if (file_exists($resultFile)) { + $result .= "{$type} "; + } + } + } + $result .= '

    '; + } + } + + return $result; } /** * Creates a templated slide * - * @param PHPPowerPoint $objPHPPowerPoint - * @return \PhpOffice\PhpPowerpoint\Slide + * @param PHPPresentation $objPHPPresentation + * @return \PhpOffice\PhpPresentation\Slide */ -function createTemplatedSlide(PhpOffice\PhpPowerpoint\PhpPowerpoint $objPHPPowerPoint) +function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPPresentation) { - // Create slide - $slide = $objPHPPowerPoint->createSlide(); - - // Add logo - $shape = $slide->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); - - // Return slide - return $slide; + // Create slide + $slide = $objPHPPresentation->createSlide(); + + // Add logo + $shape = $slide->createDrawingShape(); + $shape->setName('PHPPresentation logo') + ->setDescription('PHPPresentation logo') + ->setPath('./resources/phppowerpoint_logo.gif') + ->setHeight(36) + ->setOffsetX(10) + ->setOffsetY(10); + $shape->getShadow()->setVisible(true) + ->setDirection(45) + ->setDistance(10); + + // Return slide + return $slide; +} + +class PhpPptTree { + protected $oPhpPresentation; + protected $htmlOutput; + + public function __construct(PhpPresentation $oPHPPpt) + { + $this->oPhpPresentation = $oPHPPpt; + } + + public function display() + { + $this->append('
    '); + $this->append('
    '); + $this->append('
    '); + $this->append('
    '); + $this->append('
      '); + $this->displayPhpPresentation($this->oPhpPresentation); + $this->append('
    '); + $this->append('
    '); + $this->append('
    '); + $this->append('
    '); + $this->displayPhpPresentationInfo($this->oPhpPresentation); + $this->append('
    '); + $this->append('
    '); + $this->append('
    '); + + return $this->htmlOutput; + } + + protected function append($sHTML) + { + $this->htmlOutput .= $sHTML; + } + + protected function displayPhpPresentation(PhpPresentation $oPHPPpt) + { + $this->append('
  • PhpPresentation'); + $this->append('
      '); + $this->append('
    • Info "PhpPresentation"
    • '); + 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 Drawing) { + $this->append('
  • Shape "Drawing"
  • '); + } elseif($shape instanceof RichText) { + $this->append('
  • Shape "RichText"
  • '); + } else { + var_export($shape); + } + } + + protected function displayPhpPresentationInfo(PhpPresentation $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
    Layout::'.$this->getConstantName('\PhpOffice\PhpPresentation\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) { + $this->append('
    Name
    '.$oShape->getName().'
    '); + $this->append('
    Description
    '.$oShape->getDescription().'
    '); + 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
    '); + } elseif($oShape instanceof Drawing) { + $this->append('
    Name
    '.$oShape->getName().'
    '); + $this->append('
    Description
    '.$oShape->getDescription().'
    '); + } elseif($oShape instanceof RichText) { + $this->append('
    # of paragraphs
    '.count($oShape->getParagraphs()).'
    '); + $this->append('
    Inset (T / R / B / L)
    '.$oShape->getInsetTop().'px / '.$oShape->getInsetRight().'px / '.$oShape->getInsetBottom().'px / '.$oShape->getInsetLeft().'px
    '); + $this->append('
    Text
    '); + $this->append('
    '); + foreach ($oShape->getParagraphs() as $oParagraph) { + $this->append('Paragraph
    '); + $this->append('
    Alignment Horizontal
    Alignment::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Alignment', $oParagraph->getAlignment()->getHorizontal()).'
    '); + $this->append('
    Alignment Vertical
    Alignment::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Alignment', $oParagraph->getAlignment()->getVertical()).'
    '); + $this->append('
    Alignment Margin (L / R)
    '.$oParagraph->getAlignment()->getMarginLeft().' px / '.$oParagraph->getAlignment()->getMarginRight().'px
    '); + $this->append('
    Alignment Indent
    '.$oParagraph->getAlignment()->getIndent().' px
    '); + $this->append('
    Alignment Level
    '.$oParagraph->getAlignment()->getLevel().'
    '); + $this->append('
    Bullet Style
    Bullet::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Bullet', $oParagraph->getBulletStyle()->getBulletType()).'
    '); + $this->append('
    Bullet Font
    '.$oParagraph->getBulletStyle()->getBulletFont().'
    '); + if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_BULLET) { + $this->append('
    Bullet Char
    '.$oParagraph->getBulletStyle()->getBulletChar().'
    '); + } + if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_NUMERIC) { + $this->append('
    Bullet Start At
    '.$oParagraph->getBulletStyle()->getBulletNumericStartAt().'
    '); + $this->append('
    Bullet Style
    '.$oParagraph->getBulletStyle()->getBulletNumericStyle().'
    '); + } + $this->append('
    RichText
    '); + foreach ($oParagraph->getRichTextElements() as $oRichText) { + if($oRichText instanceof BreakElement) { + $this->append('
    Break
    '); + } else { + if ($oRichText instanceof TextElement) { + $this->append('
    TextElement
    '); + } else { + $this->append('
    Run
    '); + } + $this->append('
    '.$oRichText->getText()); + $this->append('
    '); + $this->append('
    Font Name
    '.$oRichText->getFont()->getName().'
    '); + $this->append('
    Font Size
    '.$oRichText->getFont()->getSize().'
    '); + $this->append('
    Font Color
    #'.$oRichText->getFont()->getColor()->getARGB().'
    '); + $this->append('
    Font Transform
    '); + $this->append('Bold : '.($oRichText->getFont()->isBold() ? 'Y' : 'N').' - '); + $this->append('Italic : '.($oRichText->getFont()->isItalic() ? 'Y' : 'N').' - '); + $this->append('Underline : Underline::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Font', $oRichText->getFont()->getUnderline()).' - '); + $this->append('Strikethrough : '.($oRichText->getFont()->isStrikethrough() ? 'Y' : 'N').' - '); + $this->append('SubScript : '.($oRichText->getFont()->isSubScript() ? 'Y' : 'N').' - '); + $this->append('SuperScript : '.($oRichText->getFont()->isSuperScript() ? 'Y' : 'N')); + $this->append('
    '); + if ($oRichText instanceof TextElement) { + if ($oRichText->hasHyperlink()) { + $this->append('
    Hyperlink URL
    '.$oRichText->getHyperlink()->getUrl().'
    '); + $this->append('
    Hyperlink Tooltip
    '.$oRichText->getHyperlink()->getTooltip().'
    '); + } + } + $this->append('
    '); + $this->append('
    '); + } + } + $this->append('
    '); + } + $this->append('
    '); + } else { + // Add another shape + } + $this->append('
    '); + $this->append('
    '); + } + + protected function getConstantName($class, $search, $startWith = '') { + $fooClass = new ReflectionClass($class); + $constants = $fooClass->getConstants(); + $constName = null; + foreach ($constants as $key => $value ) { + if ($value == $search) { + if (empty($startWith) || (!empty($startWith) && strpos($key, $startWith) === 0)) { + $constName = $key; + } + break; + } + } + return $constName; + } } ?> <?php echo $pageTitle; ?> @@ -144,7 +380,7 @@ function createTemplatedSlide(PhpOffice\PhpPowerpoint\PhpPowerpoint $objPHPPower - +
    @@ -157,7 +393,7 @@ function createTemplatedSlide(PhpOffice\PhpPowerpoint\PhpPowerpoint $objPHPPower - PHPPowerPoint + PHPPresentation
    diff --git a/samples/Sample_X5_Templated.php b/samples/Sample_X5_Templated.php deleted file mode 100644 index fd489e2fe..000000000 --- a/samples/Sample_X5_Templated.php +++ /dev/null @@ -1,69 +0,0 @@ -getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') - ->setTitle('Sample 05 Title') - ->setSubject('Sample 05 Subject') - ->setDescription('Sample 05 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); - -// Create a shape (text) -echo date('H:i:s') . ' Create a shape (rich text)'.EOL; -$shape = $currentSlide->createRichTextShape() - ->setHeight(400) - ->setWidth(600) - ->setOffsetX(170) - ->setOffsetY(180) - ->setInsetTop(50) - ->setInsetBottom(50); -$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' ) ); -$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/') - ->setTooltip('PHPPowerPoint'); - -// Create a shape (line) -$shape = $currentSlide->createLineShape(170, 180, 770, 180); -$shape->getBorder()->getColor()->setARGB( 'FFE06B20' ); - -// Create a shape (line) -$shape = $currentSlide->createLineShape(170, 580, 770, 580); -$shape->getBorder()->getColor()->setARGB( 'FFE06B20' ); - -// Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); -if (!CLI) { - include_once 'Sample_Footer.php'; -} \ No newline at end of file diff --git a/samples/bootstrap/css/phppowerpoint.css b/samples/bootstrap/css/phppresentation.css similarity index 100% rename from samples/bootstrap/css/phppowerpoint.css rename to samples/bootstrap/css/phppresentation.css diff --git a/samples/index.php b/samples/index.php index c2fbc7525..42e0c718b 100644 --- a/samples/index.php +++ b/samples/index.php @@ -11,11 +11,11 @@ if (!CLI) { ?>
    -

    Welcome to PHPPowerPoint, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.pptx) and Open Document Format (.odp).

    +

    Welcome to PHPPresentation, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.pptx) and Open Document Format (.odp).

     

    - Fork us on Github! - Read the Docs + Fork us on Github! + Read the Docs

    container)) { - // Add drawing to \PhpOffice\PhpPowerpoint\ShapeContainerInterface + // Add drawing to \PhpOffice\PhpPresentation\ShapeContainerInterface $this->container = $pValue; if (!is_null($this->container)) { $this->container->getShapeCollection()->append($this); } } else { if ($pOverrideOld) { - // Remove drawing from old \PhpOffice\PhpPowerpoint\ShapeContainerInterface + // Remove drawing from old \PhpOffice\PhpPresentation\ShapeContainerInterface $iterator = $this->container->getShapeCollection()->getIterator(); while ($iterator->valid()) { @@ -170,41 +170,16 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO $iterator->next(); } - // Set new \PhpOffice\PhpPowerpoint\Slide + // Set new \PhpOffice\PhpPresentation\Slide $this->setContainer($pValue); } else { - throw new \Exception("A \PhpOffice\PhpPowerpoint\ShapeContainerInterface has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\ShapeContainerInterface."); + throw new \Exception("A \PhpOffice\PhpPresentation\ShapeContainerInterface has already been assigned. Shapes can only exist on one \PhpOffice\PhpPresentation\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 * @@ -335,7 +310,7 @@ public function setRotation($pValue = 0) /** * Get Fill * - * @return \PhpOffice\PhpPowerpoint\Style\Fill + * @return \PhpOffice\PhpPresentation\Style\Fill */ public function getFill() { @@ -344,8 +319,8 @@ public function getFill() /** * Set Fill - * @param \PhpOffice\PhpPowerpoint\Style\Fill $pValue - * @return \PhpOffice\PhpPowerpoint\AbstractShape + * @param \PhpOffice\PhpPresentation\Style\Fill $pValue + * @return \PhpOffice\PhpPresentation\AbstractShape */ public function setFill(Fill $pValue = null) { @@ -356,7 +331,7 @@ public function setFill(Fill $pValue = null) /** * Get Border * - * @return \PhpOffice\PhpPowerpoint\Style\Border + * @return \PhpOffice\PhpPresentation\Style\Border */ public function getBorder() { @@ -366,7 +341,7 @@ public function getBorder() /** * Get Shadow * - * @return \PhpOffice\PhpPowerpoint\Style\Shadow + * @return \PhpOffice\PhpPresentation\Style\Shadow */ public function getShadow() { @@ -376,7 +351,7 @@ public function getShadow() /** * Set Shadow * - * @param \PhpOffice\PhpPowerpoint\Style\Shadow $pValue + * @param \PhpOffice\PhpPresentation\Style\Shadow $pValue * @throws \Exception * @return self */ @@ -399,7 +374,7 @@ public function hasHyperlink() /** * Get Hyperlink * - * @return \PhpOffice\PhpPowerpoint\Shape\Hyperlink + * @return \PhpOffice\PhpPresentation\Shape\Hyperlink */ public function getHyperlink() { @@ -412,7 +387,7 @@ public function getHyperlink() /** * Set Hyperlink * - * @param \PhpOffice\PhpPowerpoint\Shape\Hyperlink $pHyperlink + * @param \PhpOffice\PhpPresentation\Shape\Hyperlink $pHyperlink * @throws \Exception * @return self */ diff --git a/src/PhpPowerpoint/Autoloader.php b/src/PhpPresentation/Autoloader.php similarity index 72% rename from src/PhpPowerpoint/Autoloader.php rename to src/PhpPresentation/Autoloader.php index 29752d9ab..605981b09 100644 --- a/src/PhpPowerpoint/Autoloader.php +++ b/src/PhpPresentation/Autoloader.php @@ -1,21 +1,21 @@ dimensionX / 36000; - } - - /** - * Get Document Layout in millimeters - * - * @return integer - * @deprecated 0.4.0 getCY(DocumentLayout::UNIT_MILLIMETER) - */ - public function getLayoutYmilli() - { - return $this->dimensionY / 36000; - } - - /** - * Set Document Layout in millimeters - * - * @param integer $pValue Layout width - * @return \PhpOffice\PhpPowerpoint\DocumentLayout - * @deprecated 0.4.0 setCY($pValue, DocumentLayout::UNIT_MILLIMETER) - */ - public function setLayoutXmilli($pValue) - { - $this->dimensionX = $pValue * 36000; - $this->layout = self::LAYOUT_CUSTOM; - - 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) - { - $this->dimensionY = $pValue * 36000; - $this->layout = self::LAYOUT_CUSTOM; - - return $this; - } } diff --git a/src/PhpPowerpoint/DocumentProperties.php b/src/PhpPresentation/DocumentProperties.php similarity index 82% rename from src/PhpPowerpoint/DocumentProperties.php rename to src/PhpPresentation/DocumentProperties.php index c77bc5f88..c9344fed2 100644 --- a/src/PhpPowerpoint/DocumentProperties.php +++ b/src/PhpPresentation/DocumentProperties.php @@ -1,24 +1,24 @@ fileSupportsUnserializePhpPresentation($pFilename); + } + + /** + * Does a file support UnserializePhpPresentation ? + * + * @param string $pFilename + * @throws \Exception + * @return boolean + */ + public function fileSupportsUnserializePhpPresentation($pFilename = '') + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new \Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $oZip = new ZipArchive(); + // Is it a zip ? + if ($oZip->open($pFilename) === true) { + // Is it an OpenXML Document ? + // Is it a Presentation ? + if (is_array($oZip->statName('META-INF/manifest.xml')) && is_array($oZip->statName('mimetype')) && $oZip->getFromName('mimetype') == 'application/vnd.oasis.opendocument.presentation') { + return true; + } + } + return false; + } + + /** + * Loads PhpPresentation Serialized file + * + * @param string $pFilename + * @return \PhpOffice\PhpPresentation\PhpPresentation + * @throws \Exception + */ + public function load($pFilename) + { + // Unserialize... First make sure the file supports it! + if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { + throw new \Exception("Invalid file format for PhpOffice\PhpPresentation\Reader\ODPresentation: " . $pFilename . "."); + } + + return $this->loadFile($pFilename); + } + + /** + * Load PhpPresentation Serialized file + * + * @param string $pFilename + * @return \PhpOffice\PhpPresentation\PhpPresentation + */ + protected function loadFile($pFilename) + { + $this->oPhpPresentation = new PhpPresentation(); + $this->oPhpPresentation->removeSlideByIndex(); + + $this->oZip = new ZipArchive(); + $this->oZip->open($pFilename); + + $this->oXMLReader = new XMLReader(); + if ($this->oXMLReader->getDomFromZip($pFilename, 'meta.xml') !== false) { + $this->loadDocumentProperties(); + } + $this->oXMLReader = new XMLReader(); + if ($this->oXMLReader->getDomFromZip($pFilename, 'content.xml') !== false) { + $this->loadSlides(); + } + + return $this->oPhpPresentation; + } + + /** + * Read Document Properties + */ + protected function loadDocumentProperties() + { + $arrayProperties = array( + '/office:document-meta/office:meta/meta:initial-creator' => 'setCreator', + '/office:document-meta/office:meta/dc:creator' => 'setLastModifiedBy', + '/office:document-meta/office:meta/dc:title' => 'setTitle', + '/office:document-meta/office:meta/dc:description' => 'setDescription', + '/office:document-meta/office:meta/dc:subject' => 'setSubject', + '/office:document-meta/office:meta/meta:keyword' => 'setKeywords', + '/office:document-meta/office:meta/meta:creation-date' => 'setCreated', + '/office:document-meta/office:meta/dc:date' => 'setModified', + ); + $oProperties = $this->oPhpPresentation->getProperties(); + foreach ($arrayProperties as $path => $property) { + if (is_object($oElement = $this->oXMLReader->getElement($path))) { + if (in_array($property, array('setCreated', 'setModified'))) { + $oDateTime = new \DateTime(); + $oDateTime->createFromFormat(\DateTime::W3C, $oElement->nodeValue); + $oProperties->{$property}($oDateTime->getTimestamp()); + } else { + $oProperties->{$property}($oElement->nodeValue); + } + } + } + } + + /** + * Extract all slides + */ + protected function loadSlides() + { + foreach ($this->oXMLReader->getElements('/office:document-content/office:automatic-styles/*') as $oElement) { + if ($oElement->hasAttribute('style:name')) { + $this->loadStyle($oElement); + } + } + foreach ($this->oXMLReader->getElements('/office:document-content/office:body/office:presentation/draw:page') as $oElement) { + if ($oElement->nodeName == 'draw:page') { + $this->loadSlide($oElement); + } + } + } + + /** + * Extract style + * @param \DOMElement $nodeStyle + */ + protected function loadStyle(\DOMElement $nodeStyle) + { + $keyStyle = $nodeStyle->getAttribute('style:name'); + + $nodeGraphicProps = $this->oXMLReader->getElement('style:graphic-properties', $nodeStyle); + if ($nodeGraphicProps) { + // Read Shadow + if ($nodeGraphicProps->hasAttribute('draw:shadow') && $nodeGraphicProps->getAttribute('draw:shadow') == 'visible') { + $oShadow = new Shadow(); + $oShadow->setVisible(true); + if ($nodeGraphicProps->hasAttribute('draw:shadow-color')) { + $oShadow->getColor()->setRGB(substr($nodeGraphicProps->getAttribute('draw:shadow-color'), -6)); + } + if ($nodeGraphicProps->hasAttribute('draw:shadow-opacity')) { + $oShadow->setAlpha(100 - (int)substr($nodeGraphicProps->getAttribute('draw:shadow-opacity'), 0, -1)); + } + if ($nodeGraphicProps->hasAttribute('draw:shadow-offset-x') && $nodeGraphicProps->hasAttribute('draw:shadow-offset-y')) { + $offsetX = substr($nodeGraphicProps->getAttribute('draw:shadow-offset-x'), 0, -2); + $offsetY = substr($nodeGraphicProps->getAttribute('draw:shadow-offset-y'), 0, -2); + $distance = 0; + if ($offsetX != 0) { + $distance = ($offsetX < 0 ? $offsetX * -1 : $offsetX); + } elseif ($offsetY != 0) { + $distance = ($offsetY < 0 ? $offsetY * -1 : $offsetY); + } + $oShadow->setDirection(rad2deg(atan2($offsetY, $offsetX))); + $oShadow->setDistance(CommonDrawing::centimetersToPixels($distance)); + } + } + } + + $nodeTextProperties = $this->oXMLReader->getElement('style:text-properties', $nodeStyle); + if ($nodeTextProperties) { + $oFont = new Font(); + if ($nodeTextProperties->hasAttribute('fo:color')) { + $oFont->getColor()->setRGB(substr($nodeTextProperties->getAttribute('fo:color'), -6)); + } + if ($nodeTextProperties->hasAttribute('fo:font-family')) { + $oFont->setName($nodeTextProperties->getAttribute('fo:font-family')); + } + if ($nodeTextProperties->hasAttribute('fo:font-weight') && $nodeTextProperties->getAttribute('fo:font-weight') == 'bold') { + $oFont->setBold(true); + } + if ($nodeTextProperties->hasAttribute('fo:font-size')) { + $oFont->setSize(substr($nodeTextProperties->getAttribute('fo:font-size'), 0, -2)); + } + } + $nodeParagraphProps = $this->oXMLReader->getElement('style:paragraph-properties', $nodeStyle); + if ($nodeParagraphProps) { + $oAlignment = new Alignment(); + if ($nodeParagraphProps->hasAttribute('fo:text-align')) { + $oAlignment->setHorizontal($nodeParagraphProps->getAttribute('fo:text-align')); + } + } + + if ($nodeStyle->nodeName == 'text:list-style') { + $arrayListStyle = array(); + foreach ($this->oXMLReader->getElements('text:list-level-style-bullet', $nodeStyle) as $oNodeListLevel) { + $oAlignment = new Alignment(); + $oBullet = new Bullet(); + $oBullet->setBulletType(Bullet::TYPE_NONE); + if ($oNodeListLevel->hasAttribute('text:level')) { + $oAlignment->setLevel((int) $oNodeListLevel->getAttribute('text:level') - 1); + } + if ($oNodeListLevel->hasAttribute('text:bullet-char')) { + $oBullet->setBulletChar($oNodeListLevel->getAttribute('text:bullet-char')); + $oBullet->setBulletType(Bullet::TYPE_BULLET); + } + + $oNodeListProperties = $this->oXMLReader->getElement('style:list-level-properties', $oNodeListLevel); + if ($oNodeListProperties) { + if ($oNodeListProperties->hasAttribute('text:min-label-width')) { + $oAlignment->setIndent((int)round(CommonDrawing::centimetersToPixels(substr($oNodeListProperties->getAttribute('text:min-label-width'), 0, -2)))); + } + if ($oNodeListProperties->hasAttribute('text:space-before')) { + $iSpaceBefore = CommonDrawing::centimetersToPixels(substr($oNodeListProperties->getAttribute('text:space-before'), 0, -2)); + $iMarginLeft = $iSpaceBefore + $oAlignment->getIndent(); + $oAlignment->setMarginLeft($iMarginLeft); + } + } + $oNodeTextProperties = $this->oXMLReader->getElement('style:text-properties', $oNodeListLevel); + if ($oNodeTextProperties) { + if ($oNodeTextProperties->hasAttribute('fo:font-family')) { + $oBullet->setBulletFont($oNodeTextProperties->getAttribute('fo:font-family')); + } + } + + $arrayListStyle[$oAlignment->getLevel()] = array( + 'alignment' => $oAlignment, + 'bullet' => $oBullet, + ); + } + } + + $this->arrayStyles[$keyStyle] = array( + 'alignment' => isset($oAlignment) ? $oAlignment : null, + 'font' => isset($oFont) ? $oFont : null, + 'shadow' => isset($oShadow) ? $oShadow : null, + 'listStyle' => isset($arrayListStyle) ? $arrayListStyle : null, + ); + + return true; + } + + /** + * Extract data from slide + * @param \DOMElement $nodeSlide + */ + protected function loadSlide(\DOMElement $nodeSlide) + { + // Core + $this->oPhpPresentation->createSlide(); + $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1); + foreach ($this->oXMLReader->getElements('draw:frame', $nodeSlide) as $oNodeFrame) { + if ($this->oXMLReader->getElement('draw:image', $oNodeFrame)) { + $this->loadShapeDrawing($oNodeFrame); + continue; + } + if ($this->oXMLReader->getElement('draw:text-box', $oNodeFrame)) { + $this->loadShapeRichText($oNodeFrame); + continue; + } + } + return true; + } + + /** + * + * @param \DOMElement $oNodeFrame + */ + protected function loadShapeDrawing(\DOMElement $oNodeFrame) + { + // Core + $oShape = new MemoryDrawing(); + $oShape->getShadow()->setVisible(false); + + $oNodeImage = $this->oXMLReader->getElement('draw:image', $oNodeFrame); + if ($oNodeImage) { + if ($oNodeImage->hasAttribute('xlink:href')) { + $imageFile = $this->oZip->getFromName($oNodeImage->getAttribute('xlink:href')); + if (!empty($imageFile)) { + $oShape->setImageResource(imagecreatefromstring($imageFile)); + } + } + } + + $oShape->setName($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : ''); + $oShape->setDescription($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : ''); + $oShape->setResizeProportional(false); + $oShape->setWidth($oNodeFrame->hasAttribute('svg:width') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:width'), 0, -2))) : ''); + $oShape->setHeight($oNodeFrame->hasAttribute('svg:height') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:height'), 0, -2))) : ''); + $oShape->setResizeProportional(true); + $oShape->setOffsetX($oNodeFrame->hasAttribute('svg:x') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:x'), 0, -2))) : ''); + $oShape->setOffsetY($oNodeFrame->hasAttribute('svg:y') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:y'), 0, -2))) : ''); + + if ($oNodeFrame->hasAttribute('draw:style-name')) { + $keyStyle = $oNodeFrame->getAttribute('draw:style-name'); + if (isset($this->arrayStyles[$keyStyle])) { + $oShape->setShadow($this->arrayStyles[$keyStyle]['shadow']); + } + } + + $this->oPhpPresentation->getActiveSlide()->addShape($oShape); + } + + /** + * + * @param \DOMElement $oNodeFrame + */ + protected function loadShapeRichText(\DOMElement $oNodeFrame) + { + // Core + $oShape = $this->oPhpPresentation->getActiveSlide()->createRichTextShape(); + $oShape->setParagraphs(array()); + + $oShape->setWidth($oNodeFrame->hasAttribute('svg:width') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:width'), 0, -2))) : ''); + $oShape->setHeight($oNodeFrame->hasAttribute('svg:height') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:height'), 0, -2))) : ''); + $oShape->setOffsetX($oNodeFrame->hasAttribute('svg:x') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:x'), 0, -2))) : ''); + $oShape->setOffsetY($oNodeFrame->hasAttribute('svg:y') ? (int)round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:y'), 0, -2))) : ''); + + foreach ($this->oXMLReader->getElements('draw:text-box/*', $oNodeFrame) as $oNodeParagraph) { + $this->levelParagraph = 0; + if ($oNodeParagraph->nodeName == 'text:p') { + $this->readParagraph($oShape, $oNodeParagraph); + } + if ($oNodeParagraph->nodeName == 'text:list') { + $this->readList($oShape, $oNodeParagraph); + } + } + + if (count($oShape->getParagraphs()) > 0) { + $oShape->setActiveParagraph(0); + } + } + + protected $levelParagraph = 0; + + /** + * Read Paragraph + * @param RichText $oShape + * @param \DOMElement $oNodeParent + */ + protected function readParagraph(RichText $oShape, \DOMElement $oNodeParent) + { + $oParagraph = $oShape->createParagraph(); + foreach ($this->oXMLReader->getElements('text:span', $oNodeParent) as $oNodeRichTextElement) { + $this->readParagraphItem($oParagraph, $oNodeRichTextElement); + } + } + + /** + * Read Paragraph Item + * @param RichText $oShape + * @param \DOMElement $oNodeParent + */ + protected function readParagraphItem(Paragraph $oParagraph, \DOMElement $oNodeParent) + { + if ($this->oXMLReader->elementExists('text:line-break', $oNodeParent)) { + $oParagraph->createBreak(); + } else { + $oTextRun = $oParagraph->createTextRun(); + if ($oNodeParent->hasAttribute('text:style-name')) { + $keyStyle = $oNodeParent->getAttribute('text:style-name'); + if (isset($this->arrayStyles[$keyStyle])) { + $oTextRun->setFont($this->arrayStyles[$keyStyle]['font']); + } + } + if ($oTextRunLink = $this->oXMLReader->getElement('text:a', $oNodeParent)) { + $oTextRun->setText($oTextRunLink->nodeValue); + if ($oTextRunLink->hasAttribute('xlink:href')) { + $oTextRun->getHyperlink()->setUrl($oTextRunLink->getAttribute('xlink:href')); + } + } else { + $oTextRun->setText($oNodeParent->nodeValue); + } + } + } + + protected function readList(RichText $oShape, \DOMElement $oNodeParent) + { + foreach ($this->oXMLReader->getElements('text:list-item/*', $oNodeParent) as $oNodeListItem) { + if ($oNodeListItem->nodeName == 'text:p') { + $this->readListItem($oShape, $oNodeListItem, $oNodeParent); + } + if ($oNodeListItem->nodeName == 'text:list') { + $this->levelParagraph++; + $this->readList($oShape, $oNodeListItem); + $this->levelParagraph--; + } + } + } + + /** + * Read Paragraph + * @param RichText $oShape + * @param \DOMElement $oNodeParent + * @param \DOMElement $oNodeParagraph + */ + protected function readListItem(RichText $oShape, \DOMElement $oNodeParent, \DOMElement $oNodeParagraph) + { + $oParagraph = $oShape->createParagraph(); + if ($oNodeParagraph->hasAttribute('text:style-name')) { + $keyStyle = $oNodeParagraph->getAttribute('text:style-name'); + if (isset($this->arrayStyles[$keyStyle])) { + $oParagraph->setAlignment($this->arrayStyles[$keyStyle]['listStyle'][$this->levelParagraph]['alignment']); + $oParagraph->setBulletStyle($this->arrayStyles[$keyStyle]['listStyle'][$this->levelParagraph]['bullet']); + } + } + foreach ($this->oXMLReader->getElements('text:span', $oNodeParent) as $oNodeRichTextElement) { + $this->readParagraphItem($oParagraph, $oNodeRichTextElement); + } + } +} diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php new file mode 100644 index 000000000..d36fbb3ef --- /dev/null +++ b/src/PhpPresentation/Reader/PowerPoint2007.php @@ -0,0 +1,479 @@ +fileSupportsUnserializePhpPresentation($pFilename); + } + + /** + * Does a file support UnserializePhpPresentation ? + * + * @param string $pFilename + * @throws \Exception + * @return boolean + */ + public function fileSupportsUnserializePhpPresentation($pFilename = '') + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new \Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $oZip = new ZipArchive(); + // Is it a zip ? + if ($oZip->open($pFilename) === true) { + // Is it an OpenXML Document ? + // Is it a Presentation ? + if (is_array($oZip->statName('[Content_Types].xml')) && is_array($oZip->statName('ppt/presentation.xml'))) { + return true; + } + } + return false; + } + + /** + * Loads PhpPresentation Serialized file + * + * @param string $pFilename + * @return \PhpOffice\PhpPresentation\PhpPresentation + * @throws \Exception + */ + public function load($pFilename) + { + // Unserialize... First make sure the file supports it! + if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { + throw new \Exception("Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint2007: " . $pFilename . "."); + } + + return $this->loadFile($pFilename); + } + + /** + * Load PhpPresentation Serialized file + * + * @param string $pFilename + * @return \PhpOffice\PhpPresentation\PhpPresentation + */ + protected function loadFile($pFilename) + { + $this->oPhpPresentation = new PhpPresentation(); + $this->oPhpPresentation->removeSlideByIndex(); + + $this->oZip = new ZipArchive(); + $this->oZip->open($pFilename); + $docPropsCore = $this->oZip->getFromName('docProps/core.xml'); + if ($docPropsCore !== false) { + $this->loadDocumentProperties($docPropsCore); + } + + $pptPresentation = $this->oZip->getFromName('ppt/presentation.xml'); + if ($pptPresentation !== false) { + $this->loadSlides($pptPresentation); + } + + return $this->oPhpPresentation; + } + + /** + * Read Document Properties + * @param string $sPart + */ + protected function loadDocumentProperties($sPart) + { + $xmlReader = new XMLReader(); + if ($xmlReader->getDomFromString($sPart)) { + $arrayProperties = array( + '/cp:coreProperties/dc:creator' => 'setCreator', + '/cp:coreProperties/cp:lastModifiedBy' => 'setLastModifiedBy', + '/cp:coreProperties/dc:title' => 'setTitle', + '/cp:coreProperties/dc:description' => 'setDescription', + '/cp:coreProperties/dc:subject' => 'setSubject', + '/cp:coreProperties/cp:keywords' => 'setKeywords', + '/cp:coreProperties/cp:category' => 'setCategory', + '/cp:coreProperties/dcterms:created' => 'setCreated', + '/cp:coreProperties/dcterms:modified' => 'setModified', + ); + $oProperties = $this->oPhpPresentation->getProperties(); + foreach ($arrayProperties as $path => $property) { + if (is_object($oElement = $xmlReader->getElement($path))) { + if ($oElement->hasAttribute('xsi:type') && $oElement->getAttribute('xsi:type') == 'dcterms:W3CDTF') { + $oDateTime = new \DateTime(); + $oDateTime->createFromFormat(\DateTime::W3C, $oElement->nodeValue); + $oProperties->{$property}($oDateTime->getTimestamp()); + } else { + $oProperties->{$property}($oElement->nodeValue); + } + } + } + } + } + + /** + * Extract all slides + */ + protected function loadSlides($sPart) + { + $xmlReader = new XMLReader(); + if ($xmlReader->getDomFromString($sPart)) { + $fileRels = 'ppt/_rels/presentation.xml.rels'; + $this->loadRels($fileRels); + foreach ($xmlReader->getElements('/p:presentation/p:sldIdLst/p:sldId') as $oElement) { + $rId = $oElement->getAttribute('r:id'); + $pathSlide = isset($this->arrayRels[$fileRels][$rId]) ? $this->arrayRels[$fileRels][$rId] : ''; + if (!empty($pathSlide)) { + $pptSlide = $this->oZip->getFromName('ppt/'.$pathSlide); + if ($pptSlide !== false) { + $this->loadRels('ppt/slides/_rels/'.basename($pathSlide).'.rels'); + $this->loadSlide($pptSlide, basename($pathSlide)); + } + } + } + } + } + + /** + * Extract data from slide + * @param string $sPart + * @param string $baseFile + */ + protected function loadSlide($sPart, $baseFile) + { + $xmlReader = new XMLReader(); + if ($xmlReader->getDomFromString($sPart)) { + // Core + $this->oPhpPresentation->createSlide(); + $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1); + foreach ($xmlReader->getElements('/p:sld/p:cSld/p:spTree/*') as $oNode) { + switch ($oNode->tagName) { + case 'p:pic': + $this->loadShapeDrawing($xmlReader, $oNode, $baseFile); + break; + case 'p:sp': + $this->loadShapeRichText($xmlReader, $oNode, $baseFile); + break; + default: + //var_export($oNode->tagName); + } + } + } + } + + /** + * + * @param XMLReader $document + * @param \DOMElement $node + * @param string $baseFile + */ + protected function loadShapeDrawing(XMLReader $document, \DOMElement $node, $baseFile) + { + // Core + $oShape = new MemoryDrawing(); + $oShape->getShadow()->setVisible(false); + // Variables + $fileRels = 'ppt/slides/_rels/'.$baseFile.'.rels'; + + $oElement = $document->getElement('p:nvPicPr/p:cNvPr', $node); + if ($oElement) { + $oShape->setName($oElement->hasAttribute('name') ? $oElement->getAttribute('name') : ''); + $oShape->setDescription($oElement->hasAttribute('descr') ? $oElement->getAttribute('descr') : ''); + } + + $oElement = $document->getElement('p:blipFill/a:blip', $node); + if ($oElement) { + if ($oElement->hasAttribute('r:embed') && isset($this->arrayRels[$fileRels][$oElement->getAttribute('r:embed')])) { + $pathImage = 'ppt/slides/'.$this->arrayRels[$fileRels][$oElement->getAttribute('r:embed')]; + $pathImage = explode('/', $pathImage); + foreach ($pathImage as $key => $partPath) { + if ($partPath == '..') { + unset($pathImage[$key - 1]); + unset($pathImage[$key]); + } + } + $pathImage = implode('/', $pathImage); + $imageFile = $this->oZip->getFromName($pathImage); + if (!empty($imageFile)) { + $oShape->setImageResource(imagecreatefromstring($imageFile)); + } + } + } + + $oElement = $document->getElement('p:spPr/a:xfrm', $node); + if ($oElement) { + if ($oElement->hasAttribute('rot')) { + $oShape->setRotation(CommonDrawing::angleToDegrees($oElement->getAttribute('rot'))); + } + } + + $oElement = $document->getElement('p:spPr/a:xfrm/a:off', $node); + if ($oElement) { + if ($oElement->hasAttribute('x')) { + $oShape->setOffsetX(CommonDrawing::emuToPixels($oElement->getAttribute('x'))); + } + if ($oElement->hasAttribute('y')) { + $oShape->setOffsetY(CommonDrawing::emuToPixels($oElement->getAttribute('y'))); + } + } + + $oElement = $document->getElement('p:spPr/a:xfrm/a:ext', $node); + if ($oElement) { + if ($oElement->hasAttribute('cx')) { + $oShape->setWidth(CommonDrawing::emuToPixels($oElement->getAttribute('cx'))); + } + if ($oElement->hasAttribute('cy')) { + $oShape->setHeight(CommonDrawing::emuToPixels($oElement->getAttribute('cy'))); + } + } + + $oElement = $document->getElement('p:spPr/a:effectLst', $node); + if ($oElement) { + $oShape->getShadow()->setVisible(true); + + $oSubElement = $document->getElement('a:outerShdw', $oElement); + if ($oSubElement) { + if ($oSubElement->hasAttribute('blurRad')) { + $oShape->getShadow()->setBlurRadius(CommonDrawing::emuToPixels($oSubElement->getAttribute('blurRad'))); + } + if ($oSubElement->hasAttribute('dist')) { + $oShape->getShadow()->setDistance(CommonDrawing::emuToPixels($oSubElement->getAttribute('dist'))); + } + if ($oSubElement->hasAttribute('dir')) { + $oShape->getShadow()->setDirection(CommonDrawing::angleToDegrees($oSubElement->getAttribute('dir'))); + } + if ($oSubElement->hasAttribute('algn')) { + $oShape->getShadow()->setAlignment($oSubElement->getAttribute('algn')); + } + } + + $oSubElement = $document->getElement('a:outerShdw/a:srgbClr', $oElement); + if ($oSubElement) { + if ($oSubElement->hasAttribute('val')) { + $oColor = new Color(); + $oColor->setRGB($oSubElement->getAttribute('val')); + $oShape->getShadow()->setColor($oColor); + } + } + + $oSubElement = $document->getElement('a:outerShdw/a:srgbClr/a:alpha', $oElement); + if ($oSubElement) { + if ($oSubElement->hasAttribute('val')) { + $oShape->getShadow()->setAlpha((int) $oSubElement->getAttribute('val') / 1000); + } + } + } + + $this->oPhpPresentation->getActiveSlide()->addShape($oShape); + } + + protected function loadShapeRichText(XMLReader $document, \DOMElement $node, $baseFile) + { + // Core + $oShape = $this->oPhpPresentation->getActiveSlide()->createRichTextShape(); + $oShape->setParagraphs(array()); + // Variables + $fileRels = 'ppt/slides/_rels/'.$baseFile.'.rels'; + + $oElement = $document->getElement('p:spPr/a:xfrm', $node); + if ($oElement && $oElement->hasAttribute('rot')) { + $oShape->setRotation(CommonDrawing::angleToDegrees($oElement->getAttribute('rot'))); + } + + $oElement = $document->getElement('p:spPr/a:xfrm/a:off', $node); + if ($oElement) { + if ($oElement->hasAttribute('x')) { + $oShape->setOffsetX(CommonDrawing::emuToPixels($oElement->getAttribute('x'))); + } + if ($oElement->hasAttribute('y')) { + $oShape->setOffsetY(CommonDrawing::emuToPixels($oElement->getAttribute('y'))); + } + } + + $oElement = $document->getElement('p:spPr/a:xfrm/a:ext', $node); + if ($oElement) { + if ($oElement->hasAttribute('cx')) { + $oShape->setWidth(CommonDrawing::emuToPixels($oElement->getAttribute('cx'))); + } + if ($oElement->hasAttribute('cy')) { + $oShape->setHeight(CommonDrawing::emuToPixels($oElement->getAttribute('cy'))); + } + } + + $arrayElements = $document->getElements('p:txBody/a:p', $node); + foreach ($arrayElements as $oElement) { + // Core + $oParagraph = $oShape->createParagraph(); + $oParagraph->setRichTextElements(array()); + + $oSubElement = $document->getElement('a:pPr', $oElement); + if ($oSubElement) { + if ($oSubElement->hasAttribute('algn')) { + $oParagraph->getAlignment()->setHorizontal($oSubElement->getAttribute('algn')); + } + if ($oSubElement->hasAttribute('fontAlgn')) { + $oParagraph->getAlignment()->setVertical($oSubElement->getAttribute('fontAlgn')); + } + if ($oSubElement->hasAttribute('marL')) { + $oParagraph->getAlignment()->setMarginLeft(CommonDrawing::emuToPixels($oSubElement->getAttribute('marL'))); + } + if ($oSubElement->hasAttribute('marR')) { + $oParagraph->getAlignment()->setMarginRight(CommonDrawing::emuToPixels($oSubElement->getAttribute('marR'))); + } + if ($oSubElement->hasAttribute('indent')) { + $oParagraph->getAlignment()->setIndent(CommonDrawing::emuToPixels($oSubElement->getAttribute('indent'))); + } + if ($oSubElement->hasAttribute('lvl')) { + $oParagraph->getAlignment()->setLevel($oSubElement->getAttribute('lvl')); + } + + $oElementBuFont = $document->getElement('a:buFont', $oSubElement); + $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE); + if ($oElementBuFont) { + if ($oElementBuFont->hasAttribute('typeface')) { + $oParagraph->getBulletStyle()->setBulletFont($oElementBuFont->getAttribute('typeface')); + } + } + $oElementBuChar = $document->getElement('a:buChar', $oSubElement); + if ($oElementBuChar) { + $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); + if ($oElementBuChar->hasAttribute('char')) { + $oParagraph->getBulletStyle()->setBulletChar($oElementBuChar->getAttribute('char')); + } + } + /*$oElementBuAutoNum = $document->getElement('a:buAutoNum', $oSubElement); + if ($oElementBuAutoNum) { + $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NUMERIC); + if ($oElementBuAutoNum->hasAttribute('type')) { + $oParagraph->getBulletStyle()->setBulletNumericStyle($oElementBuAutoNum->getAttribute('type')); + } + if ($oElementBuAutoNum->hasAttribute('startAt') && $oElementBuAutoNum->getAttribute('startAt') != 1) { + $oParagraph->getBulletStyle()->setBulletNumericStartAt($oElementBuAutoNum->getAttribute('startAt')); + } + }*/ + } + $arraySubElements = $document->getElements('(a:r|a:br)', $oElement); + foreach ($arraySubElements as $oSubElement) { + if ($oSubElement->tagName == 'a:br') { + $oParagraph->createBreak(); + } + if ($oSubElement->tagName == 'a:r') { + $oElementrPr = $document->getElement('a:rPr', $oSubElement); + if (is_object($oElementrPr)) { + $oText = $oParagraph->createTextRun(); + + if ($oElementrPr->hasAttribute('b')) { + $oText->getFont()->setBold($oElementrPr->getAttribute('b') == 'true' ? true : false); + } + if ($oElementrPr->hasAttribute('i')) { + $oText->getFont()->setItalic($oElementrPr->getAttribute('i') == 'true' ? true : false); + } + if ($oElementrPr->hasAttribute('strike')) { + $oText->getFont()->setStrikethrough($oElementrPr->getAttribute('strike') == 'noStrike' ? false : true); + } + if ($oElementrPr->hasAttribute('sz')) { + $oText->getFont()->setSize((int)($oElementrPr->getAttribute('sz') / 100)); + } + if ($oElementrPr->hasAttribute('u')) { + $oText->getFont()->setUnderline($oElementrPr->getAttribute('u')); + } + // Color + $oElementSrgbClr = $document->getElement('a:solidFill/a:srgbClr', $oElementrPr); + if (is_object($oElementSrgbClr) && $oElementSrgbClr->hasAttribute('val')) { + $oColor = new Color(); + $oColor->setRGB($oElementSrgbClr->getAttribute('val')); + $oText->getFont()->setColor($oColor); + } + // Hyperlink + $oElementHlinkClick = $document->getElement('a:hlinkClick', $oElementrPr); + if (is_object($oElementHlinkClick)) { + if ($oElementHlinkClick->hasAttribute('tooltip')) { + $oText->getHyperlink()->setTooltip($oElementHlinkClick->getAttribute('tooltip')); + } + if ($oElementHlinkClick->hasAttribute('r:id') && isset($this->arrayRels[$fileRels][$oElementHlinkClick->getAttribute('r:id')])) { + $oText->getHyperlink()->setUrl($this->arrayRels[$fileRels][$oElementHlinkClick->getAttribute('r:id')]); + } + } + //} else { + // $oText = $oParagraph->createText(); + } + + $oSubSubElement = $document->getElement('a:t', $oSubElement); + $oText->setText($oSubSubElement->nodeValue); + } + } + } + + if (count($oShape->getParagraphs()) > 0) { + $oShape->setActiveParagraph(0); + } + } + + /** + * + * @param string $fileRels + * @return string + */ + protected function loadRels($fileRels) + { + $sPart = $this->oZip->getFromName($fileRels); + if ($sPart !== false) { + $xmlReader = new XMLReader(); + if ($xmlReader->getDomFromString($sPart)) { + foreach ($xmlReader->getElements('*') as $oNode) { + $this->arrayRels[$fileRels][$oNode->getAttribute('Id')] = $oNode->getAttribute('Target'); + } + } + } + } +} diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPresentation/Reader/PowerPoint97.php similarity index 98% rename from src/PhpPowerpoint/Reader/PowerPoint97.php rename to src/PhpPresentation/Reader/PowerPoint97.php index 47fbe04bc..c2215e622 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPresentation/Reader/PowerPoint97.php @@ -1,36 +1,36 @@ fileSupportsUnserializePHPPowerPoint($pFilename); + return $this->fileSupportsUnserializePhpPresentation($pFilename); } /** - * Does a file support UnserializePHPPowerPoint ? + * Does a file support UnserializePhpPresentation ? * * @param string $pFilename * @throws \Exception * @return boolean */ - public function fileSupportsUnserializePHPPowerPoint($pFilename = '') + public function fileSupportsUnserializePhpPresentation($pFilename = '') { // Check if file exists if (!file_exists($pFilename)) { @@ -391,37 +391,32 @@ public function fileSupportsUnserializePHPPowerPoint($pFilename = '') } /** - * Loads PHPPowerPoint Serialized file + * Loads PhpPresentation Serialized file * * @param string $pFilename - * @return \PhpOffice\PhpPowerpoint\PhpPowerpoint + * @return \PhpOffice\PhpPresentation\PhpPresentation * @throws \Exception */ public function load($pFilename) { - // Check if file exists - if (!file_exists($pFilename)) { - throw new \Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - // Unserialize... First make sure the file supports it! - if (!$this->fileSupportsUnserializePHPPowerPoint($pFilename)) { - throw new \Exception("Invalid file format for PhpOffice\PhpPowerpoint\Reader\PowerPoint97: " . $pFilename . "."); + if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { + throw new \Exception("Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint97: " . $pFilename . "."); } return $this->loadFile($pFilename); } /** - * Load PHPPowerPoint Serialized file + * Load PhpPresentation Serialized file * * @param string $pFilename - * @return \PhpOffice\PhpPowerpoint\PhpPowerpoint + * @return \PhpOffice\PhpPresentation\PhpPresentation */ private function loadFile($pFilename) { - $this->oPhpPowerpoint = new PhpPowerpoint(); - $this->oPhpPowerpoint->removeSlideByIndex(); + $this->oPhpPresentation = new PhpPresentation(); + $this->oPhpPresentation->removeSlideByIndex(); // Read OLE Blocks $this->loadOLE($pFilename); @@ -432,7 +427,7 @@ private function loadFile($pFilename) // Read information in the PowerPoint Document Stream $this->loadPowerpointDocumentStream(); - return $this->oPhpPowerpoint; + return $this->oPhpPresentation; } /** @@ -1256,7 +1251,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) if ($char == 0x0B) { $char = 0x20; } - $arrayReturn['text'] .= String::chr($char); + $arrayReturn['text'] .= Text::chr($char); $arrayReturn['length'] += 1; } break; @@ -1269,7 +1264,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) if ($char == 0x0B) { $char = 0x20; } - $arrayReturn['text'] .= String::chr($char); + $arrayReturn['text'] .= Text::chr($char); $arrayReturn['length'] += 2; } break; @@ -1608,7 +1603,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal switch ($rhFileBlock['recType']) { case 0xF003: // Core - $this->oCurrentGroup = $this->oPhpPowerpoint->getActiveSlide()->createGroup(); + $this->oCurrentGroup = $this->oPhpPresentation->getActiveSlide()->createGroup(); $this->bFirstShapeGroup = false; // OfficeArtSpgrContainer $fileBlock = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length'], true); @@ -1630,7 +1625,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal if ($bInGroup) { $this->oCurrentGroup->addShape($fileBlock['shape']); } else { - $this->oPhpPowerpoint->getActiveSlide()->addShape($fileBlock['shape']); + $this->oPhpPresentation->getActiveSlide()->addShape($fileBlock['shape']); } } @@ -2557,8 +2552,8 @@ private function readRecordSlideAtom($stream, $pos) private function readRecordSlideContainer($stream, $pos) { // Core - $this->oPhpPowerpoint->createSlide(); - $this->oPhpPowerpoint->setActiveSlideIndex($this->oPhpPowerpoint->getSlideCount() - 1); + $this->oPhpPresentation->createSlide(); + $this->oPhpPresentation->setActiveSlideIndex($this->oPhpPresentation->getSlideCount() - 1); // *** slideAtom (32 bytes) $slideAtom = $this->readRecordSlideAtom($stream, $pos); @@ -2623,7 +2618,7 @@ private function readRecordSlideNameAtom($stream, $pos) for ($inc = 0; $inc < $strLen; $inc++) { $char = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; - $arrayReturn['slideName'] .= String::chr($char); + $arrayReturn['slideName'] .= Text::chr($char); } } diff --git a/src/PhpPowerpoint/Reader/ReaderInterface.php b/src/PhpPresentation/Reader/ReaderInterface.php similarity index 54% rename from src/PhpPowerpoint/Reader/ReaderInterface.php rename to src/PhpPresentation/Reader/ReaderInterface.php index ac173f514..2a4157e7d 100644 --- a/src/PhpPowerpoint/Reader/ReaderInterface.php +++ b/src/PhpPresentation/Reader/ReaderInterface.php @@ -1,21 +1,21 @@ fileSupportsUnserializePHPPowerPoint($pFilename); + return $this->fileSupportsUnserializePhpPresentation($pFilename); } /** - * Does a file support UnserializePHPPowerPoint ? + * Does a file support UnserializePhpPresentation ? * * @param string $pFilename * @throws \Exception * @return boolean */ - public function fileSupportsUnserializePHPPowerPoint($pFilename = '') + public function fileSupportsUnserializePhpPresentation($pFilename = '') { // Check if file exists if (!file_exists($pFilename)) { throw new \Exception("Could not open " . $pFilename . " for reading! File does not exist."); } - // File exists, does it contain PHPPowerPoint.xml? - return File::fileExists("zip://$pFilename#PHPPowerPoint.xml"); + // File exists, does it contain PhpPresentation.xml? + return File::fileExists("zip://$pFilename#PhpPresentation.xml"); } /** - * Loads PHPPowerPoint Serialized file + * Loads PhpPresentation Serialized file * * @param string $pFilename - * @return \PhpOffice\PhpPowerpoint\PhpPowerpoint + * @return \PhpOffice\PhpPresentation\PhpPresentation * @throws \Exception */ public function load($pFilename) @@ -70,24 +70,24 @@ 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 . "."); + if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { + throw new \Exception("Invalid file format for PhpOffice\PhpPresentation\Reader\Serialized: " . $pFilename . "."); } return $this->loadSerialized($pFilename); } /** - * Load PHPPowerPoint Serialized file + * Load PhpPresentation Serialized file * * @param string $pFilename - * @return \PhpOffice\PhpPowerpoint\PhpPowerpoint + * @return \PhpOffice\PhpPresentation\PhpPresentation */ private function loadSerialized($pFilename) { $oArchive = new \ZipArchive(); if ($oArchive->open($pFilename) === true) { - $xmlContent = $oArchive->getFromName('PHPPowerPoint.xml'); + $xmlContent = $oArchive->getFromName('PhpPresentation.xml'); if (!empty($xmlContent)) { $xmlData = simplexml_load_string($xmlContent); diff --git a/src/PhpPowerpoint/Shape/AbstractDrawing.php b/src/PhpPresentation/Shape/AbstractDrawing.php similarity index 83% rename from src/PhpPowerpoint/Shape/AbstractDrawing.php rename to src/PhpPresentation/Shape/AbstractDrawing.php index b5e915a36..1a11119e9 100644 --- a/src/PhpPowerpoint/Shape/AbstractDrawing.php +++ b/src/PhpPresentation/Shape/AbstractDrawing.php @@ -1,24 +1,24 @@ setResizeProportional(true); * @example $objDrawing->setWidthAndHeight(160,120); - * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing + * @return \PhpOffice\PhpPresentation\Shape\AbstractDrawing */ public function setWidthAndHeight($width = 0, $height = 0) { @@ -228,7 +228,7 @@ public function isResizeProportional() * Set ResizeProportional * * @param boolean $pValue - * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing + * @return \PhpOffice\PhpPresentation\Shape\AbstractDrawing */ public function setResizeProportional($pValue = true) { diff --git a/src/PhpPowerpoint/Shape/Chart.php b/src/PhpPresentation/Shape/Chart.php similarity index 67% rename from src/PhpPowerpoint/Shape/Chart.php rename to src/PhpPresentation/Shape/Chart.php index 46cbffac0..73a7ed690 100644 --- a/src/PhpPowerpoint/Shape/Chart.php +++ b/src/PhpPresentation/Shape/Chart.php @@ -1,27 +1,27 @@ getActiveParagraph()->getAlignment(); - $font = clone $this->getActiveParagraph()->getFont(); - $bulletStyle = clone $this->getActiveParagraph()->getBulletStyle(); + $numParagraphs = count($this->richTextParagraphs); + if ($numParagraphs > 0) { + $alignment = clone $this->getActiveParagraph()->getAlignment(); + $font = clone $this->getActiveParagraph()->getFont(); + $bulletStyle = clone $this->getActiveParagraph()->getBulletStyle(); + } $this->richTextParagraphs[] = new Paragraph(); $this->activeParagraph = count($this->richTextParagraphs) - 1; - $this->getActiveParagraph()->setAlignment($alignment); - $this->getActiveParagraph()->setFont($font); - $this->getActiveParagraph()->setBulletStyle($bulletStyle); - + if (isset($alignment)) { + $this->getActiveParagraph()->setAlignment($alignment); + } + if (isset($font)) { + $this->getActiveParagraph()->setFont($font); + } + if (isset($bulletStyle)) { + $this->getActiveParagraph()->setBulletStyle($bulletStyle); + } return $this->getActiveParagraph(); } /** * Add text * - * @param \PhpOffice\PhpPowerpoint\Shape\RichText\TextElementInterface $pText Rich text element + * @param \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface $pText Rich text element * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function addText(TextElementInterface $pText = null) { @@ -264,7 +272,7 @@ public function addText(TextElementInterface $pText = null) * Create text (can not be formatted !) * * @param string $pText Text - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\TextElement + * @return \PhpOffice\PhpPresentation\Shape\RichText\TextElement * @throws \Exception */ public function createText($pText = '') @@ -275,7 +283,7 @@ public function createText($pText = '') /** * Create break * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\BreakElement + * @return \PhpOffice\PhpPresentation\Shape\RichText\BreakElement * @throws \Exception */ public function createBreak() @@ -287,7 +295,7 @@ public function createBreak() * Create text run (can be formatted) * * @param string $pText Text - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\Run + * @return \PhpOffice\PhpPresentation\Shape\RichText\Run * @throws \Exception */ public function createTextRun($pText = '') @@ -305,7 +313,7 @@ public function getPlainText() // Return value $returnValue = ''; - // Loop trough all \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph + // Loop trough all \PhpOffice\PhpPresentation\Shape\RichText\Paragraph foreach ($this->richTextParagraphs as $p) { $returnValue .= $p->getPlainText(); } @@ -327,7 +335,7 @@ public function __toString() /** * Get paragraphs * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] + * @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] */ public function getParagraphs() { @@ -337,9 +345,9 @@ public function getParagraphs() /** * Set paragraphs * - * @param \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] $paragraphs Array of paragraphs + * @param \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] $paragraphs Array of paragraphs * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setParagraphs($paragraphs = null) { @@ -347,7 +355,7 @@ public function setParagraphs($paragraphs = null) $this->richTextParagraphs = $paragraphs; $this->activeParagraph = count($this->richTextParagraphs) - 1; } else { - throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] array passed."); + throw new \Exception("Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed."); } return $this; @@ -367,7 +375,7 @@ public function getWrap() * Set text wrapping * * @param $value string - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setWrap($value = self::WRAP_SQUARE) { @@ -412,7 +420,7 @@ public function getLineSpaceReduction() * @param $value string * @param $fontScale float * @param $lnSpcReduction float - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setAutoFit($value = self::AUTOFIT_DEFAULT, $fontScale = null, $lnSpcReduction = null) { @@ -443,7 +451,7 @@ public function getHorizontalOverflow() * Set horizontal overflow * * @param $value string - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setHorizontalOverflow($value = self::OVERFLOW_OVERFLOW) { @@ -466,7 +474,7 @@ public function getVerticalOverflow() * Set vertical overflow * * @param $value string - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setVerticalOverflow($value = self::OVERFLOW_OVERFLOW) { @@ -489,7 +497,7 @@ public function isUpright() * Set vertical * * @param $value boolean - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setUpright($value = false) { @@ -512,7 +520,7 @@ public function isVertical() * Set vertical * * @param $value boolean - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setVertical($value = false) { @@ -536,7 +544,7 @@ public function getColumns() * * @param $value int * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setColumns($value = 1) { @@ -563,7 +571,7 @@ public function getInsetBottom() * Set bottom inset * * @param $value float - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setInsetBottom($value = 4.8) { @@ -586,7 +594,7 @@ public function getInsetLeft() * Set left inset * * @param $value float - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setInsetLeft($value = 9.6) { @@ -609,7 +617,7 @@ public function getInsetRight() * Set left inset * * @param $value float - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setInsetRight($value = 9.6) { @@ -632,7 +640,7 @@ public function getInsetTop() * Set top inset * * @param $value float - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setInsetTop($value = 4.8) { diff --git a/src/PhpPowerpoint/Shape/RichText/BreakElement.php b/src/PhpPresentation/Shape/RichText/BreakElement.php similarity index 63% rename from src/PhpPowerpoint/Shape/RichText/BreakElement.php rename to src/PhpPresentation/Shape/RichText/BreakElement.php index 0543c3171..4b5d37367 100644 --- a/src/PhpPowerpoint/Shape/RichText/BreakElement.php +++ b/src/PhpPresentation/Shape/RichText/BreakElement.php @@ -1,21 +1,21 @@ richTextElements as $text) { if ($text instanceof TextElementInterface) { $returnValue .= $text->getText(); @@ -238,7 +238,7 @@ public function __toString() /** * Get Rich Text elements * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\TextElementInterface[] + * @return \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface[] */ public function getRichTextElements() { @@ -248,16 +248,16 @@ public function getRichTextElements() /** * Set Rich Text elements * - * @param \PhpOffice\PhpPowerpoint\Shape\RichText\TextElementInterface[] $pElements Array of elements + * @param \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface[] $pElements Array of elements * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph + * @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph */ public function setRichTextElements($pElements = null) { if (is_array($pElements)) { $this->richTextElements = $pElements; } else { - throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\TextElementInterface[] array passed."); + throw new \Exception("Invalid \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface[] array passed."); } return $this; diff --git a/src/PhpPowerpoint/Shape/RichText/Run.php b/src/PhpPresentation/Shape/RichText/Run.php similarity index 60% rename from src/PhpPowerpoint/Shape/RichText/Run.php rename to src/PhpPresentation/Shape/RichText/Run.php index ba124c80d..97455c0f1 100644 --- a/src/PhpPowerpoint/Shape/RichText/Run.php +++ b/src/PhpPresentation/Shape/RichText/Run.php @@ -1,23 +1,23 @@ richTextParagraphs as $p) { $returnValue .= $p->getPlainText(); } @@ -258,7 +258,7 @@ public function __toString() /** * Get paragraphs * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] + * @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] */ public function getParagraphs() { @@ -268,9 +268,9 @@ public function getParagraphs() /** * Set paragraphs * - * @param \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] $paragraphs Array of paragraphs + * @param \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] $paragraphs Array of paragraphs * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setParagraphs($paragraphs = null) { @@ -278,7 +278,7 @@ public function setParagraphs($paragraphs = null) $this->richTextParagraphs = $paragraphs; $this->activeParagraph = count($this->richTextParagraphs) - 1; } else { - throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] array passed."); + throw new \Exception("Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed."); } return $this; @@ -287,7 +287,7 @@ public function setParagraphs($paragraphs = null) /** * Get fill * - * @return \PhpOffice\PhpPowerpoint\Style\Fill + * @return \PhpOffice\PhpPresentation\Style\Fill */ public function getFill() { @@ -297,8 +297,8 @@ public function getFill() /** * Set fill * - * @param \PhpOffice\PhpPowerpoint\Style\Fill $fill - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @param \PhpOffice\PhpPresentation\Style\Fill $fill + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setFill(Fill $fill) { @@ -310,7 +310,7 @@ public function setFill(Fill $fill) /** * Get borders * - * @return \PhpOffice\PhpPowerpoint\Style\Borders + * @return \PhpOffice\PhpPresentation\Style\Borders */ public function getBorders() { @@ -320,8 +320,8 @@ public function getBorders() /** * Set borders * - * @param \PhpOffice\PhpPowerpoint\Style\Borders $borders - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @param \PhpOffice\PhpPresentation\Style\Borders $borders + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setBorders(Borders $borders) { @@ -344,7 +344,7 @@ public function getWidth() * Set width * * @param int $value - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setWidth($value = 0) { @@ -367,7 +367,7 @@ public function getColSpan() * Set colSpan * * @param int $value - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setColSpan($value = 0) { @@ -390,7 +390,7 @@ public function getRowSpan() * Set rowSpan * * @param int $value - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function setRowSpan($value = 0) { diff --git a/src/PhpPowerpoint/Shape/Table/Row.php b/src/PhpPresentation/Shape/Table/Row.php similarity index 77% rename from src/PhpPowerpoint/Shape/Table/Row.php rename to src/PhpPresentation/Shape/Table/Row.php index 48b9d589e..4f427f02d 100644 --- a/src/PhpPowerpoint/Shape/Table/Row.php +++ b/src/PhpPresentation/Shape/Table/Row.php @@ -1,24 +1,24 @@ parent = $pParent; @@ -136,7 +136,7 @@ public function __construct(PhpPowerpoint $pParent = null) /** * Get collection of shapes * - * @return \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] + * @return \ArrayObject|\PhpOffice\PhpPresentation\AbstractShape[] */ public function getShapeCollection() { @@ -146,8 +146,8 @@ public function getShapeCollection() /** * Add shape to slide * - * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape - * @return \PhpOffice\PhpPowerpoint\AbstractShape + * @param \PhpOffice\PhpPresentation\AbstractShape $shape + * @return \PhpOffice\PhpPresentation\AbstractShape */ public function addShape(AbstractShape $shape) { @@ -159,7 +159,7 @@ public function addShape(AbstractShape $shape) /** * Create rich text shape * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText + * @return \PhpOffice\PhpPresentation\Shape\RichText */ public function createRichTextShape() { @@ -176,7 +176,7 @@ public function createRichTextShape() * @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 + * @return \PhpOffice\PhpPresentation\Shape\Line */ public function createLineShape($fromX, $fromY, $toX, $toY) { @@ -189,7 +189,7 @@ public function createLineShape($fromX, $fromY, $toX, $toY) /** * Create chart shape * - * @return \PhpOffice\PhpPowerpoint\Shape\Chart + * @return \PhpOffice\PhpPresentation\Shape\Chart */ public function createChartShape() { @@ -202,7 +202,7 @@ public function createChartShape() /** * Create drawing shape * - * @return \PhpOffice\PhpPowerpoint\Shape\Drawing + * @return \PhpOffice\PhpPresentation\Shape\Drawing */ public function createDrawingShape() { @@ -216,7 +216,7 @@ public function createDrawingShape() * Create table shape * * @param int $columns Number of columns - * @return \PhpOffice\PhpPowerpoint\Shape\Table + * @return \PhpOffice\PhpPresentation\Shape\Table */ public function createTableShape($columns = 1) { @@ -229,7 +229,7 @@ public function createTableShape($columns = 1) /** * Creates a group within this slide * - * @return \PhpOffice\PhpPowerpoint\Shape\Group + * @return \PhpOffice\PhpPresentation\Shape\Group */ public function createGroup() { @@ -242,7 +242,7 @@ public function createGroup() /** * Get parent * - * @return PHPPowerPoint + * @return PhpPresentation */ public function getParent() { @@ -252,10 +252,10 @@ public function getParent() /** * Re-bind parent * - * @param \PhpOffice\PhpPowerpoint\PhpPowerpoint $parent - * @return \PhpOffice\PhpPowerpoint\Slide + * @param \PhpOffice\PhpPresentation\PhpPresentation $parent + * @return \PhpOffice\PhpPresentation\Slide */ - public function rebindParent(PhpPowerpoint $parent) + public function rebindParent(PhpPresentation $parent) { $this->parent->removeSlideByIndex($this->parent->getIndex($this)); $this->parent = $parent; @@ -277,7 +277,7 @@ public function getSlideLayout() * Set slide layout * * @param string $layout - * @return \PhpOffice\PhpPowerpoint\Slide + * @return \PhpOffice\PhpPresentation\Slide */ public function setSlideLayout($layout = Layout::BLANK) { @@ -300,7 +300,7 @@ public function getSlideMasterId() * Set slide master id * * @param int $masterId - * @return \PhpOffice\PhpPowerpoint\Slide + * @return \PhpOffice\PhpPresentation\Slide */ public function setSlideMasterId($masterId = 1) { @@ -348,7 +348,7 @@ public function setHashIndex($value) /** * Copy slide (!= clone!) * - * @return \PhpOffice\PhpPowerpoint\Slide + * @return \PhpOffice\PhpPresentation\Slide */ public function copy() { @@ -419,7 +419,7 @@ public function getExtentY() /** * - * @return \PhpOffice\PhpPowerpoint\Slide\Note + * @return \PhpOffice\PhpPresentation\Slide\Note */ public function getNote() { @@ -431,8 +431,8 @@ public function getNote() /** * - * @param \PhpOffice\PhpPowerpoint\Slide\Note $note - * @return \PhpOffice\PhpPowerpoint\Slide + * @param \PhpOffice\PhpPresentation\Slide\Note $note + * @return \PhpOffice\PhpPresentation\Slide */ public function setNote(Note $note = null) { @@ -444,7 +444,7 @@ public function setNote(Note $note = null) /** * - * @return \PhpOffice\PhpPowerpoint\Slide\Transition + * @return \PhpOffice\PhpPresentation\Slide\Transition */ public function getTransition() { @@ -453,8 +453,8 @@ public function getTransition() /** * - * @param \PhpOffice\PhpPowerpoint\Slide\Transition $transition - * @return \PhpOffice\PhpPowerpoint\Slide + * @param \PhpOffice\PhpPresentation\Slide\Transition $transition + * @return \PhpOffice\PhpPresentation\Slide */ public function setTransition(Transition $transition = null) { diff --git a/src/PhpPowerpoint/Slide/Iterator.php b/src/PhpPresentation/Slide/Iterator.php similarity index 62% rename from src/PhpPowerpoint/Slide/Iterator.php rename to src/PhpPresentation/Slide/Iterator.php index a1aba3ff6..72043c1d4 100644 --- a/src/PhpPowerpoint/Slide/Iterator.php +++ b/src/PhpPresentation/Slide/Iterator.php @@ -1,35 +1,35 @@ subject = $subject; @@ -68,9 +68,9 @@ public function rewind() } /** - * Current \PhpOffice\PhpPowerpoint\Slide + * Current \PhpOffice\PhpPresentation\Slide * - * @return \PhpOffice\PhpPowerpoint\Slide + * @return \PhpOffice\PhpPresentation\Slide */ public function current() { @@ -96,7 +96,7 @@ public function next() } /** - * More \PhpOffice\PhpPowerpoint\Slide instances available? + * More \PhpOffice\PhpPresentation\Slide instances available? * * @return boolean */ diff --git a/src/PhpPowerpoint/Slide/Layout.php b/src/PhpPresentation/Slide/Layout.php similarity index 67% rename from src/PhpPowerpoint/Slide/Layout.php rename to src/PhpPresentation/Slide/Layout.php index 16b289291..b4fc02767 100644 --- a/src/PhpPowerpoint/Slide/Layout.php +++ b/src/PhpPresentation/Slide/Layout.php @@ -1,24 +1,24 @@ setStrikethrough($pValue); - } - /** * Get Strikethrough * @@ -341,7 +329,7 @@ public function isStrikethrough() * Set Strikethrough * * @param boolean $pValue - * @return \PhpOffice\PhpPowerpoint\Style\Font + * @return \PhpOffice\PhpPresentation\Style\Font */ public function setStrikethrough($pValue = false) { @@ -356,7 +344,7 @@ public function setStrikethrough($pValue = false) /** * Get Color * - * @return \PhpOffice\PhpPowerpoint\Style\Color + * @return \PhpOffice\PhpPresentation\Style\Color */ public function getColor() { @@ -366,9 +354,9 @@ public function getColor() /** * Set Color * - * @param \PhpOffice\PhpPowerpoint\Style\Color $pValue + * @param \PhpOffice\PhpPresentation\Style\Color $pValue * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Style\Font + * @return \PhpOffice\PhpPresentation\Style\Font */ public function setColor(Color $pValue = null) { diff --git a/src/PhpPowerpoint/Style/Shadow.php b/src/PhpPresentation/Style/Shadow.php similarity index 88% rename from src/PhpPowerpoint/Style/Shadow.php rename to src/PhpPresentation/Style/Shadow.php index a0dff288d..f500de951 100644 --- a/src/PhpPowerpoint/Style/Shadow.php +++ b/src/PhpPresentation/Style/Shadow.php @@ -1,26 +1,26 @@ setPHPPowerPoint($pPHPPowerPoint); + // Assign PhpPresentation + $this->setPhpPresentation($pPhpPresentation); // Set up disk caching location $this->diskCachingDirectory = './'; @@ -107,7 +107,7 @@ public function __construct(PhpPowerpoint $pPHPPowerPoint = null) } /** - * Save PHPPowerPoint to file + * Save PhpPresentation to file * * @param string $pFilename * @throws \Exception @@ -129,31 +129,31 @@ public function save($pFilename) $writerPartChart = $this->getWriterPart('charts'); if (!$writerPartChart instanceof ObjectsChart) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\ObjectsChart'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\ODPresentation\Mimetype'); } $writerPartStyles = $this->getWriterPart('styles'); if (!$writerPartStyles instanceof Styles) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Styles'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\ODPresentation\Styles'); } // Create drawing dictionary @@ -200,7 +200,7 @@ public function save($pFilename) for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { $shape = $this->getDrawingHashTable()->getByIndex($i); if (!($shape instanceof AbstractDrawing)) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Shape\AbstractDrawing'); } if ($shape instanceof ShapeDrawing) { if (!in_array(md5($shape->getPath()), $arrMedia)) { @@ -251,35 +251,35 @@ public function save($pFilename) } } } else { - throw new \Exception("PHPPowerPoint object unassigned."); + throw new \Exception("PhpPresentation object unassigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @return PhpPowerpoint + * @return PhpPresentation * @throws \Exception */ - public function getPHPPowerPoint() + public function getPhpPresentation() { if (!is_null($this->presentation)) { return $this->presentation; } else { - throw new \Exception("No PHPPowerPoint assigned."); + throw new \Exception("No PhpPresentation assigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @param PhpPowerpoint $pPHPPowerPoint PhpPowerpoint object + * @param PhpPresentation $pPhpPresentation PhpPresentation object * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @return \PhpOffice\PhpPresentation\Writer\ODPresentation */ - public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) + public function setPhpPresentation(PhpPresentation $pPhpPresentation = null) { - $this->presentation = $pPHPPowerPoint; + $this->presentation = $pPhpPresentation; return $this; } @@ -287,7 +287,7 @@ public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) /** * Get drawing hash table * - * @return \PhpOffice\PhpPowerpoint\HashTable + * @return \PhpOffice\PhpPresentation\HashTable */ public function getDrawingHashTable() { @@ -298,7 +298,7 @@ public function getDrawingHashTable() * Get writer part * * @param string $pPartName Writer part name - * @return \PhpOffice\PhpPowerpoint\Writer\ODPresentation\AbstractPart + * @return \PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractPart */ public function getWriterPart($pPartName = '') { @@ -325,7 +325,7 @@ public function hasDiskCaching() * @param boolean $pValue * @param string $pDirectory Disk caching directory * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @return \PhpOffice\PhpPresentation\Writer\ODPresentation */ public function setUseDiskCaching($pValue = false, $pDirectory = null) { diff --git a/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php b/src/PhpPresentation/Writer/ODPresentation/AbstractPart.php similarity index 57% rename from src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php rename to src/PhpPresentation/Writer/ODPresentation/AbstractPart.php index 9c8b94c0c..636b6b001 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php +++ b/src/PhpPresentation/Writer/ODPresentation/AbstractPart.php @@ -1,45 +1,45 @@ parentWriter)) { return $this->parentWriter; } else { - throw new \Exception("No parent \PhpOffice\PhpPowerpoint\Writer\WriterInterface assigned."); + throw new \Exception("No parent \PhpOffice\PhpPresentation\Writer\WriterInterface assigned."); } } @@ -69,7 +69,7 @@ protected function getXMLWriter() { $parentWriter = $this->getParentWriter(); if (!$parentWriter instanceof ODPresentation) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\ODPresentation'); } if ($parentWriter->hasDiskCaching()) { return new XMLWriter(XMLWriter::STORAGE_DISK, $parentWriter->getDiskCachingDirectory()); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPresentation/Writer/ODPresentation/Content.php similarity index 90% rename from src/PhpPowerpoint/Writer/ODPresentation/Content.php rename to src/PhpPresentation/Writer/ODPresentation/Content.php index e5e82f3a2..9f4214c3c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPresentation/Writer/ODPresentation/Content.php @@ -1,48 +1,48 @@ getXMLWriter(); @@ -129,7 +129,7 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $this->shapeId = 0; $incSlide = 0; - foreach ($pPHPPowerPoint->getAllSlides() as $pSlide) { + foreach ($pPhpPresentation->getAllSlides() as $pSlide) { // Slides $this->writeStyleSlide($objWriter, $pSlide, $incSlide); @@ -263,10 +263,10 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $objWriter->startElement('office:presentation'); // Write slides - $slideCount = $pPHPPowerPoint->getSlideCount(); + $slideCount = $pPhpPresentation->getSlideCount(); $this->shapeId = 0; for ($i = 0; $i < $slideCount; ++$i) { - $pSlide = $pPHPPowerPoint->getSlide($i); + $pSlide = $pPhpPresentation->getSlide($i); $objWriter->startElement('draw:page'); $objWriter->writeAttribute('draw:name', 'page' . $i); $objWriter->writeAttribute('draw:master-page-name', 'Standard'); @@ -311,17 +311,17 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) * Write picture * * @param \PhpOffice\Common\XMLWriter $objWriter - * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape + * @param \PhpOffice\PhpPresentation\Shape\AbstractDrawing $shape */ 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(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('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); // draw:image $objWriter->startElement('draw:image'); @@ -360,17 +360,17 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) * Write text * * @param \PhpOffice\Common\XMLWriter $objWriter - * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape + * @param \PhpOffice\PhpPresentation\Shape\RichText $shape */ 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(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('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', Text::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(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'); + $objWriter->writeAttribute('svg:x1', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y1', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x2', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()+$shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y2', Text::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(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'); + $objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); // table:table $objWriter->startElement('table:table'); @@ -634,17 +634,17 @@ 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'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\ODPresentation'); } $parentWriter->chartArray[$this->shapeId] = $shape; // draw:frame $objWriter->startElement('draw:frame'); $objWriter->writeAttribute('draw:name', $shape->getTitle()->getText()); - $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'); + $objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); // draw:object $objWriter->startElement('draw:object'); @@ -726,7 +726,7 @@ public function writeGroupStyle(XMLWriter $objWriter, Group $group) * Write the default style information for a RichText shape * * @param \PhpOffice\Common\XMLWriter $objWriter - * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape + * @param \PhpOffice\PhpPresentation\Shape\RichText $shape */ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) { @@ -837,7 +837,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) * Write the default style information for an AbstractDrawing * * @param \PhpOffice\Common\XMLWriter $objWriter - * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape + * @param \PhpOffice\PhpPresentation\Shape\AbstractDrawing $shape */ public function writeDrawingStyle(XMLWriter $objWriter, AbstractDrawing $shape) { @@ -888,7 +888,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(CommonDrawing::pixelsToCentimeters((CommonDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); + $objWriter->writeAttribute('svg:stroke-width', Text::numberFormat(CommonDrawing::pixelsToCentimeters((CommonDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); $objWriter->endElement(); $objWriter->endElement(); @@ -910,7 +910,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(CommonDrawing::pixelsToCentimeters(CommonDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); + $objWriter->writeAttribute('style:row-height', Text::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); $objWriter->endElement(); $objWriter->endElement(); @@ -940,7 +940,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) && $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); + $lineWidth = Text::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); switch ($shapeCell->getBorders()->getBottom()->getLineStyle()) { case Border::LINE_SINGLE: @@ -949,7 +949,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $objWriter->writeAttribute('fo:border', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); } else { $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); + $lineWidth = Text::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); switch ($shapeCell->getBorders()->getBottom()->getLineStyle()) { case Border::LINE_SINGLE: @@ -958,7 +958,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $objWriter->writeAttribute('fo:border-bottom', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); // TOP $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getTop()->getLineWidth() / 1.75, 2); + $lineWidth = Text::numberFormat($shapeCell->getBorders()->getTop()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getTop()->getColor()->getRGB(); switch ($shapeCell->getBorders()->getTop()->getLineStyle()) { case Border::LINE_SINGLE: @@ -967,7 +967,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $objWriter->writeAttribute('fo:border-top', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); // RIGHT $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getRight()->getLineWidth() / 1.75, 2); + $lineWidth = Text::numberFormat($shapeCell->getBorders()->getRight()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getRight()->getColor()->getRGB(); switch ($shapeCell->getBorders()->getRight()->getLineStyle()) { case Border::LINE_SINGLE: @@ -976,7 +976,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $objWriter->writeAttribute('fo:border-right', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); // LEFT $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getLeft()->getLineWidth() / 1.75, 2); + $lineWidth = Text::numberFormat($shapeCell->getBorders()->getLeft()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getLeft()->getColor()->getRGB(); switch ($shapeCell->getBorders()->getLeft()->getLineStyle()) { case Border::LINE_SINGLE: @@ -1005,7 +1005,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) /** * Write the slide note * @param XMLWriter $objWriter - * @param \PhpOffice\PhpPowerpoint\Slide\Note $note + * @param \PhpOffice\PhpPresentation\Slide\Note $note */ public function writeSlideNote(XMLWriter $objWriter, Note $note) { @@ -1215,6 +1215,11 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) } + /** + * @param XMLWriter $objWriter + * @param Shadow $oShadow + * @todo Improve for supporting any direction (https://sinepost.wordpress.com/2012/02/16/theyve-got-atan-you-want-atan2/) + */ protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow) { $objWriter->writeAttribute('draw:shadow', 'visible'); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php b/src/PhpPresentation/Writer/ODPresentation/Drawing.php similarity index 57% rename from src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php rename to src/PhpPresentation/Writer/ODPresentation/Drawing.php index 0f59a733d..1f9fc003b 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php +++ b/src/PhpPresentation/Writer/ODPresentation/Drawing.php @@ -1,49 +1,49 @@ getSlideCount(); + // Loop trough PhpPresentation + $slideCount = $pPhpPresentation->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { // Loop trough images and add to array - $iterator = $pPHPPowerPoint->getSlide($i)->getShapeCollection()->getIterator(); + $iterator = $pPhpPresentation->getSlide($i)->getShapeCollection()->getIterator(); while ($iterator->valid()) { if ($iterator->current() instanceof AbstractDrawing && !($iterator->current() instanceof Table)) { $aDrawings[] = $iterator->current(); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php b/src/PhpPresentation/Writer/ODPresentation/Manifest.php similarity index 87% rename from src/PhpPowerpoint/Writer/ODPresentation/Manifest.php rename to src/PhpPresentation/Writer/ODPresentation/Manifest.php index 64c65fda3..9408aed8d 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php +++ b/src/PhpPresentation/Writer/ODPresentation/Manifest.php @@ -1,30 +1,30 @@ getParentWriter(); if (!$parentWriter instanceof ODPresentation) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\ODPresentation'); } // Create XML writer diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Meta.php b/src/PhpPresentation/Writer/ODPresentation/Meta.php similarity index 62% rename from src/PhpPowerpoint/Writer/ODPresentation/Meta.php rename to src/PhpPresentation/Writer/ODPresentation/Meta.php index c9d7da689..75fe0e463 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Meta.php +++ b/src/PhpPresentation/Writer/ODPresentation/Meta.php @@ -1,37 +1,37 @@ getXMLWriter(); @@ -58,25 +58,25 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) $objWriter->startElement('office:meta'); // dc:creator - $objWriter->writeElement('dc:creator', $pPHPPowerPoint->getProperties()->getLastModifiedBy()); + $objWriter->writeElement('dc:creator', $pPhpPresentation->getProperties()->getLastModifiedBy()); // dc:date - $objWriter->writeElement('dc:date', gmdate('Y-m-d\TH:i:s.000', $pPHPPowerPoint->getProperties()->getModified())); + $objWriter->writeElement('dc:date', gmdate('Y-m-d\TH:i:s.000', $pPhpPresentation->getProperties()->getModified())); // dc:description - $objWriter->writeElement('dc:description', $pPHPPowerPoint->getProperties()->getDescription()); + $objWriter->writeElement('dc:description', $pPhpPresentation->getProperties()->getDescription()); // dc:subject - $objWriter->writeElement('dc:subject', $pPHPPowerPoint->getProperties()->getSubject()); + $objWriter->writeElement('dc:subject', $pPhpPresentation->getProperties()->getSubject()); // dc:title - $objWriter->writeElement('dc:title', $pPHPPowerPoint->getProperties()->getTitle()); + $objWriter->writeElement('dc:title', $pPhpPresentation->getProperties()->getTitle()); // meta:creation-date - $objWriter->writeElement('meta:creation-date', gmdate('Y-m-d\TH:i:s.000', $pPHPPowerPoint->getProperties()->getCreated())); + $objWriter->writeElement('meta:creation-date', gmdate('Y-m-d\TH:i:s.000', $pPhpPresentation->getProperties()->getCreated())); // meta:initial-creator - $objWriter->writeElement('meta:initial-creator', $pPHPPowerPoint->getProperties()->getCreator()); + $objWriter->writeElement('meta:initial-creator', $pPhpPresentation->getProperties()->getCreator()); // meta:keyword - $objWriter->writeElement('meta:keyword', $pPHPPowerPoint->getProperties()->getKeywords()); + $objWriter->writeElement('meta:keyword', $pPhpPresentation->getProperties()->getKeywords()); // @todo : Where these properties are written ? - // $pPHPPowerPoint->getProperties()->getCategory() - // $pPHPPowerPoint->getProperties()->getCompany() + // $pPhpPresentation->getProperties()->getCategory() + // $pPhpPresentation->getProperties()->getCompany() $objWriter->endElement(); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Mimetype.php b/src/PhpPresentation/Writer/ODPresentation/Mimetype.php similarity index 54% rename from src/PhpPowerpoint/Writer/ODPresentation/Mimetype.php rename to src/PhpPresentation/Writer/ODPresentation/Mimetype.php index be6bf7aa2..16a9fb9ec 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Mimetype.php +++ b/src/PhpPresentation/Writer/ODPresentation/Mimetype.php @@ -1,26 +1,26 @@ xmlContent->startElement('office:chart'); // office:chart $this->xmlContent->startElement('chart:chart'); - $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('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getWidth()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:height', Text::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'); @@ -277,7 +277,7 @@ private function writeAxis(Chart $chart) /** * @param Chart $chart - * @todo Set function in \PhpPowerpoint\Shape\Chart\Axis for defining width and color of the axis + * @todo Set function in \PhpPresentation\Shape\Chart\Axis for defining width and color of the axis */ private function writeAxisStyle(Chart $chart) { @@ -387,8 +387,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(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetX()), 3) . 'cm'); - $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetY()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetX()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetY()), 3) . 'cm'); $this->xmlContent->writeAttribute('style:legend-expansion', 'high'); $this->xmlContent->writeAttribute('chart:style-name', 'styleLegend'); // > chart:legend @@ -764,8 +764,8 @@ private function writeTitle(Title $oTitle) 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('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetX()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->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/PhpPresentation/Writer/ODPresentation/Styles.php similarity index 90% rename from src/PhpPowerpoint/Writer/ODPresentation/Styles.php rename to src/PhpPresentation/Writer/ODPresentation/Styles.php index a607fc9cd..cd9f02fde 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPresentation/Writer/ODPresentation/Styles.php @@ -1,34 +1,34 @@ getXMLWriter(); @@ -96,7 +96,7 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) $objWriter->writeAttribute('office:version', '1.2'); // Variables - $stylePageLayout = $pPHPPowerPoint->getLayout()->getDocumentLayout(); + $stylePageLayout = $pPhpPresentation->getLayout()->getDocumentLayout(); // office:styles $objWriter->startElement('office:styles'); @@ -113,7 +113,7 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) // > style:style $objWriter->endElement(); - foreach ($pPHPPowerPoint->getAllSlides() as $slide) { + foreach ($pPhpPresentation->getAllSlides() as $slide) { foreach ($slide->getShapeCollection() as $shape) { if ($shape instanceof Table) { $this->writeTableStyle($objWriter, $shape); @@ -142,9 +142,9 @@ 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(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('fo:page-width', Text::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::emuToPixels($pPhpPresentation->getLayout()->getCX())), 1) . 'cm'); + $objWriter->writeAttribute('fo:page-height', Text::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::emuToPixels($pPhpPresentation->getLayout()->getCY())), 1) . 'cm'); + if ($pPhpPresentation->getLayout()->getCX() > $pPhpPresentation->getLayout()->getCY()) { $objWriter->writeAttribute('style:print-orientation', 'landscape'); } else { $objWriter->writeAttribute('style:print-orientation', 'portrait'); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPresentation/Writer/PowerPoint2007.php similarity index 80% rename from src/PhpPowerpoint/Writer/PowerPoint2007.php rename to src/PhpPresentation/Writer/PowerPoint2007.php index d5faa7806..360a1a302 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPresentation/Writer/PowerPoint2007.php @@ -1,41 +1,41 @@ setPHPPowerPoint($pPHPPowerPoint); + // Assign PhpPresentation + $this->setPhpPresentation($pPhpPresentation); // Set up disk caching location $this->diskCachingDir = './'; @@ -128,7 +128,7 @@ public function __construct(PhpPowerpoint $pPHPPowerPoint = null) * Get writer part * * @param string $pPartName Writer part name - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\AbstractPart + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractPart */ public function getWriterPart($pPartName = '') { @@ -140,7 +140,7 @@ public function getWriterPart($pPartName = '') } /** - * Save PHPPowerPoint to file + * Save PhpPresentation to file * * @param string $pFilename * @throws \Exception @@ -162,39 +162,39 @@ public function save($pFilename) $wPartDrawing = $this->getWriterPart('Drawing'); if (!$wPartDrawing instanceof Drawing) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Drawing'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Drawing'); } $wPartContentTypes = $this->getWriterPart('ContentTypes'); if (!$wPartContentTypes instanceof ContentTypes) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\ContentTypes'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\ContentTypes'); } $wPartRels = $this->getWriterPart('Rels'); if (!$wPartRels instanceof Rels) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Rels'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Rels'); } $wPartDocProps = $this->getWriterPart('DocProps'); if (!$wPartDocProps instanceof DocProps) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\DocProps'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\DocProps'); } $wPartTheme = $this->getWriterPart('Theme'); if (!$wPartTheme instanceof Theme) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Theme'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Theme'); } $wPartPresentation = $this->getWriterPart('Presentation'); if (!$wPartPresentation instanceof Presentation) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Presentation'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Presentation'); } $wPartSlide = $this->getWriterPart('Slide'); if (!$wPartSlide instanceof Slide) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Slide'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Slide'); } $wPartChart = $this->getWriterPart('Chart'); if (!$wPartChart instanceof Chart) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Chart'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\Chart'); } $wPptProps = $this->getWriterPart('PptProps'); if (!$wPptProps instanceof PptProps) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\PptProps'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007\PptProps'); } // Create drawing dictionary @@ -329,35 +329,35 @@ public function save($pFilename) } } } else { - throw new \Exception("PHPPowerPoint object unassigned."); + throw new \Exception("PhpPresentation object unassigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @return PHPPowerPoint + * @return PhpPresentation * @throws \Exception */ - public function getPHPPowerPoint() + public function getPhpPresentation() { if (!is_null($this->presentation)) { return $this->presentation; } else { - throw new \Exception("No PHPPowerPoint assigned."); + throw new \Exception("No PhpPresentation assigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @param PhpPowerpoint $pPHPPowerPoint PhpPowerpoint object + * @param PhpPresentation $pPhpPresentation PhpPresentation object * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007 */ - public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) + public function setPhpPresentation(PhpPresentation $pPhpPresentation = null) { - $this->presentation = $pPHPPowerPoint; + $this->presentation = $pPhpPresentation; return $this; } @@ -365,7 +365,7 @@ public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) /** * Get hash table * - * @return \PhpOffice\PhpPowerpoint\HashTable + * @return \PhpOffice\PhpPresentation\HashTable */ public function getDrawingHashTable() { @@ -386,7 +386,7 @@ public function hasOffice2003Compatibility() * Set Pre-Calculate Formulas * * @param boolean $pValue Office2003 compatibility? - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007 */ public function setOffice2003Compatibility($pValue = false) { @@ -411,7 +411,7 @@ public function hasDiskCaching() * @param boolean $pValue * @param string $pDirectory Disk caching directory * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007 */ public function setUseDiskCaching($pValue = false, $pDirectory = null) { @@ -441,7 +441,7 @@ public function getDiskCachingDirectory() /** * Get layout pack to use * - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\AbstractLayoutPack + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractLayoutPack */ public function getLayoutPack() { @@ -451,8 +451,8 @@ public function getLayoutPack() /** * Set layout pack to use * - * @param \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\AbstractLayoutPack $pValue - * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + * @param \PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractLayoutPack $pValue + * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007 */ public function setLayoutPack(AbstractLayoutPack $pValue = null) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php b/src/PhpPresentation/Writer/PowerPoint2007/AbstractLayoutPack.php similarity index 89% rename from src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php rename to src/PhpPresentation/Writer/PowerPoint2007/AbstractLayoutPack.php index abfd57ad8..5ff54f0cb 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/AbstractLayoutPack.php @@ -1,24 +1,24 @@ parentWriter)) { return $this->parentWriter; } else { - throw new \Exception("No parent \PhpOffice\PhpPowerpoint\Writer\WriterInterface assigned."); + throw new \Exception("No parent \PhpOffice\PhpPresentation\Writer\WriterInterface assigned."); } } @@ -66,7 +66,7 @@ protected function getXMLWriter() { $parentWriter = $this->getParentWriter(); if (!$parentWriter instanceof PowerPoint2007) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007'); } if ($parentWriter->hasDiskCaching()) { return new XMLWriter(XMLWriter::STORAGE_DISK, $parentWriter->getDiskCachingDirectory()); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPresentation/Writer/PowerPoint2007/Chart.php similarity index 96% rename from src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php rename to src/PhpPresentation/Writer/PowerPoint2007/Chart.php index 0ccd8d565..d94a18516 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Chart.php @@ -1,49 +1,49 @@ hasIncludedSpreadsheet()) { @@ -385,7 +385,7 @@ protected function writeMultipleValuesOrReference($objWriter, $isReference, $val * Write Title * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Title $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Title $subject * @throws \Exception */ protected function writeTitle(XMLWriter $objWriter, Title $subject) @@ -493,8 +493,8 @@ protected function writeTitle(XMLWriter $objWriter, Title $subject) * Write Plot Area * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea $subject - * @param \PhpOffice\PhpPowerpoint\Shape\Chart $chart + * @param \PhpOffice\PhpPresentation\Shape\Chart\PlotArea $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart $chart * @throws \Exception */ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeChart $chart) @@ -748,7 +748,7 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC * Write Legend * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Legend $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Legend $subject * @throws \Exception */ protected function writeLegend(XMLWriter $objWriter, Legend $subject) @@ -912,7 +912,7 @@ protected function writeLayout(XMLWriter $objWriter, $subject) * Write Type Line * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Area $subject * @param boolean $includeSheet * @throws \Exception */ @@ -1088,7 +1088,7 @@ protected function writeTypeArea(XMLWriter $objWriter, Area $subject, $includeSh * Write Type Bar3D * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Bar $subject * @param boolean $includeSheet * @throws \Exception */ @@ -1313,7 +1313,7 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee * Write Type Bar3D * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D $subject * @param boolean $includeSheet * @throws \Exception */ @@ -1520,8 +1520,8 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include /** * Write Type Pie * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie $subject + * @param \PhpOffice\PhpPresentation\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Pie $subject * @param boolean $includeSheet * @throws \Exception */ @@ -1690,7 +1690,7 @@ protected function writeTypePie(XMLWriter $objWriter, Pie $subject, $includeShee * Write Type Pie3D * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D $subject * @param boolean $includeSheet * @throws \Exception */ @@ -1864,7 +1864,7 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, $include * Write Type Line * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Line $subject * @param boolean $includeSheet * @throws \Exception */ @@ -2039,7 +2039,7 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh * Write Type Scatter * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter $subject + * @param \PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter $subject * @param boolean $includeSheet * @throws \Exception */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php similarity index 89% rename from src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php rename to src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php index 69f179681..8c90bdb80 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php @@ -1,47 +1,47 @@ getParentWriter(); if (!$parentWriter instanceof PowerPoint2007) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007'); + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPresentation\Writer\PowerPoint2007'); } // Create XML writer $objWriter = $this->getXMLWriter(); @@ -91,10 +91,10 @@ public function writeContentTypes(PhpPowerpoint $pPHPPowerPoint) } // Slides - $slideCount = $pPHPPowerPoint->getSlideCount(); + $slideCount = $pPhpPresentation->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) { + if ($pPhpPresentation->getSlide($i)->getNote()->getShapeCollection()->count() > 0) { $this->writeOverrideContentType($objWriter, '/ppt/notesSlides/notesSlide' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml'); } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php b/src/PhpPresentation/Writer/PowerPoint2007/DocProps.php similarity index 70% rename from src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php rename to src/PhpPresentation/Writer/PowerPoint2007/DocProps.php index 3cae3cafb..966b49965 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocProps.php @@ -1,37 +1,37 @@ getXMLWriter(); @@ -48,7 +48,7 @@ public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) $objWriter->writeElement('Application', 'Microsoft Office PowerPoint'); // Slides - $objWriter->writeElement('Slides', $pPHPPowerPoint->getSlideCount()); + $objWriter->writeElement('Slides', $pPhpPresentation->getSlideCount()); // ScaleCrop $objWriter->writeElement('ScaleCrop', 'false'); @@ -100,7 +100,7 @@ public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) $objWriter->endElement(); // Company - $objWriter->writeElement('Company', $pPHPPowerPoint->getProperties()->getCompany()); + $objWriter->writeElement('Company', $pPhpPresentation->getProperties()->getCompany()); // LinksUpToDate $objWriter->writeElement('LinksUpToDate', 'false'); @@ -123,11 +123,11 @@ public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) /** * Write docProps/core.xml to XML format * - * @param PhpPowerpoint $pPHPPowerPoint + * @param PhpPresentation $pPhpPresentation * @return string XML Output * @throws \Exception */ - public function writeDocPropsCore(PhpPowerpoint $pPHPPowerPoint) + public function writeDocPropsCore(PhpPresentation $pPhpPresentation) { // Create XML writer $objWriter = $this->getXMLWriter(); @@ -144,37 +144,37 @@ public function writeDocPropsCore(PhpPowerpoint $pPHPPowerPoint) $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); // dc:creator - $objWriter->writeElement('dc:creator', $pPHPPowerPoint->getProperties()->getCreator()); + $objWriter->writeElement('dc:creator', $pPhpPresentation->getProperties()->getCreator()); // cp:lastModifiedBy - $objWriter->writeElement('cp:lastModifiedBy', $pPHPPowerPoint->getProperties()->getLastModifiedBy()); + $objWriter->writeElement('cp:lastModifiedBy', $pPhpPresentation->getProperties()->getLastModifiedBy()); // dcterms:created $objWriter->startElement('dcterms:created'); $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); - $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $pPHPPowerPoint->getProperties()->getCreated())); + $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $pPhpPresentation->getProperties()->getCreated())); $objWriter->endElement(); // dcterms:modified $objWriter->startElement('dcterms:modified'); $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); - $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $pPHPPowerPoint->getProperties()->getModified())); + $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $pPhpPresentation->getProperties()->getModified())); $objWriter->endElement(); // dc:title - $objWriter->writeElement('dc:title', $pPHPPowerPoint->getProperties()->getTitle()); + $objWriter->writeElement('dc:title', $pPhpPresentation->getProperties()->getTitle()); // dc:description - $objWriter->writeElement('dc:description', $pPHPPowerPoint->getProperties()->getDescription()); + $objWriter->writeElement('dc:description', $pPhpPresentation->getProperties()->getDescription()); // dc:subject - $objWriter->writeElement('dc:subject', $pPHPPowerPoint->getProperties()->getSubject()); + $objWriter->writeElement('dc:subject', $pPhpPresentation->getProperties()->getSubject()); // cp:keywords - $objWriter->writeElement('cp:keywords', $pPHPPowerPoint->getProperties()->getKeywords()); + $objWriter->writeElement('cp:keywords', $pPhpPresentation->getProperties()->getKeywords()); // cp:category - $objWriter->writeElement('cp:category', $pPHPPowerPoint->getProperties()->getCategory()); + $objWriter->writeElement('cp:category', $pPhpPresentation->getProperties()->getCategory()); $objWriter->endElement(); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php b/src/PhpPresentation/Writer/PowerPoint2007/Drawing.php similarity index 57% rename from src/PhpPowerpoint/Writer/ODPresentation/Drawing.php rename to src/PhpPresentation/Writer/PowerPoint2007/Drawing.php index 74f33422c..4acd2087b 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Drawing.php @@ -1,49 +1,49 @@ getSlideCount(); + // Loop trough PhpPresentation + $slideCount = $pPhpPresentation->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { // Loop trough images and add to array - $iterator = $pPHPPowerPoint->getSlide($i)->getShapeCollection()->getIterator(); + $iterator = $pPhpPresentation->getSlide($i)->getShapeCollection()->getIterator(); while ($iterator->valid()) { if ($iterator->current() instanceof AbstractDrawing && !($iterator->current() instanceof Table)) { $aDrawings[] = $iterator->current(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php b/src/PhpPresentation/Writer/PowerPoint2007/LayoutPack/PackDefault.php similarity index 99% rename from src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php rename to src/PhpPresentation/Writer/PowerPoint2007/LayoutPack/PackDefault.php index c37a67964..db5b13355 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/LayoutPack/PackDefault.php @@ -1,32 +1,32 @@ masterSlides, array( - "\PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\LayoutPack\TemplateBased", + "\PhpOffice\PhpPresentation\Writer\PowerPoint2007\LayoutPack\TemplateBased", "cmpMaster" )); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php b/src/PhpPresentation/Writer/PowerPoint2007/PptProps.php similarity index 89% rename from src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php rename to src/PhpPresentation/Writer/PowerPoint2007/PptProps.php index ad5d268aa..27dd316ff 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptProps.php @@ -1,23 +1,23 @@ getXMLWriter(); @@ -77,15 +77,15 @@ public function writePresentation(PhpPowerpoint $pPHPPowerPoint) // p:sldIdLst $objWriter->startElement('p:sldIdLst'); - $this->writeSlides($objWriter, $pPHPPowerPoint, $relationId); + $this->writeSlides($objWriter, $pPhpPresentation, $relationId); $objWriter->endElement(); // p:sldSz $objWriter->startElement('p:sldSz'); - $objWriter->writeAttribute('cx', $pPHPPowerPoint->getLayout()->getCX()); - $objWriter->writeAttribute('cy', $pPHPPowerPoint->getLayout()->getCY()); - if ($pPHPPowerPoint->getLayout()->getDocumentLayout() != DocumentLayout::LAYOUT_CUSTOM) { - $objWriter->writeAttribute('type', $pPHPPowerPoint->getLayout()->getDocumentLayout()); + $objWriter->writeAttribute('cx', $pPhpPresentation->getLayout()->getCX()); + $objWriter->writeAttribute('cy', $pPhpPresentation->getLayout()->getCY()); + if ($pPhpPresentation->getLayout()->getDocumentLayout() != DocumentLayout::LAYOUT_CUSTOM) { + $objWriter->writeAttribute('type', $pPhpPresentation->getLayout()->getDocumentLayout()); } $objWriter->endElement(); @@ -105,14 +105,14 @@ public function writePresentation(PhpPowerpoint $pPHPPowerPoint) * Write slides * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param PhpPowerpoint $pPHPPowerPoint + * @param PhpPresentation $pPhpPresentation * @param int $startRelationId * @throws \Exception */ - private function writeSlides(XMLWriter $objWriter, PhpPowerpoint $pPHPPowerPoint, $startRelationId = 2) + private function writeSlides(XMLWriter $objWriter, PhpPresentation $pPhpPresentation, $startRelationId = 2) { // Write slides - $slideCount = $pPHPPowerPoint->getSlideCount(); + $slideCount = $pPhpPresentation->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { // p:sldId $this->writeSlide($objWriter, ($i + 256), ($i + $startRelationId)); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPresentation/Writer/PowerPoint2007/Rels.php similarity index 94% rename from src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php rename to src/PhpPresentation/Writer/PowerPoint2007/Rels.php index 2452dee6d..b72f28eeb 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Rels.php @@ -1,37 +1,37 @@ getXMLWriter(); @@ -105,7 +105,7 @@ public function writePresentationRelationships(PhpPowerpoint $pPHPPowerPoint) $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', 'theme/theme1.xml'); // Relationships with slides - $slideCount = $pPHPPowerPoint->getSlideCount(); + $slideCount = $pPhpPresentation->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slides/slide' . ($i + 1) . '.xml'); } @@ -259,7 +259,7 @@ public function writeThemeRelationships($masterId = 1) /** * Write slide relationships to XML format * - * @param \PhpOffice\PhpPowerpoint\Slide $pSlide + * @param \PhpOffice\PhpPresentation\Slide $pSlide * @return string XML Output * @throws \Exception */ @@ -510,7 +510,7 @@ public function writeSlideRelationships(SlideElement $pSlide) /** * Write chart relationships to XML format * - * @param \PhpOffice\PhpPowerpoint\Shape\Chart $pChart + * @param \PhpOffice\PhpPresentation\Shape\Chart $pChart * @return string XML Output * @throws \Exception */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPresentation/Writer/PowerPoint2007/Slide.php similarity index 95% rename from src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php rename to src/PhpPresentation/Writer/PowerPoint2007/Slide.php index a67395b1b..fb0983770 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Slide.php @@ -1,42 +1,42 @@ startElement('a:t'); - $objWriter->writeCData(String::controlCharacterPHP2OOXML($element->getText())); + $objWriter->writeCData(Text::controlCharacterPHP2OOXML($element->getText())); $objWriter->endElement(); $objWriter->endElement(); @@ -917,7 +917,7 @@ private function writeParagraphs(XMLWriter $objWriter, $paragraphs) * Write Line Shape * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Line $shape + * @param \PhpOffice\PhpPresentation\Shape\Line $shape * @param int $shapeId */ private function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) @@ -1023,7 +1023,7 @@ private function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) * Write Border * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Style\Border $pBorder Border + * @param \PhpOffice\PhpPresentation\Style\Border $pBorder Border * @param string $pElementName Element name * @throws \Exception */ @@ -1090,7 +1090,7 @@ protected function writeBorder(XMLWriter $objWriter, Border $pBorder, $pElementN * Write Fill * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style + * @param \PhpOffice\PhpPresentation\Style\Fill $pFill Fill style * @throws \Exception */ protected function writeFill(XMLWriter $objWriter, Fill $pFill) @@ -1120,7 +1120,7 @@ protected function writeFill(XMLWriter $objWriter, Fill $pFill) * Write Solid Fill * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style + * @param \PhpOffice\PhpPresentation\Style\Fill $pFill Fill style * @throws \Exception */ protected function writeSolidFill(XMLWriter $objWriter, Fill $pFill) @@ -1140,7 +1140,7 @@ protected function writeSolidFill(XMLWriter $objWriter, Fill $pFill) * Write Gradient Fill * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style + * @param \PhpOffice\PhpPresentation\Style\Fill $pFill Fill style * @throws \Exception */ protected function writeGradientFill(XMLWriter $objWriter, Fill $pFill) @@ -1187,7 +1187,7 @@ protected function writeGradientFill(XMLWriter $objWriter, Fill $pFill) * Write Pattern Fill * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style + * @param \PhpOffice\PhpPresentation\Style\Fill $pFill Fill style * @throws \Exception */ protected function writePatternFill(XMLWriter $objWriter, Fill $pFill) @@ -1251,7 +1251,7 @@ protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) * Write hyperlink * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\AbstractShape|\PhpOffice\PhpPowerpoint\Shape\RichText\TextElement $shape + * @param \PhpOffice\PhpPresentation\AbstractShape|\PhpOffice\PhpPresentation\Shape\RichText\TextElement $shape */ private function writeHyperlink(XMLWriter $objWriter, $shape) { @@ -1274,7 +1274,7 @@ public function writeNote(Note $pNote = null) { // Check slide if (is_null($pNote)) { - throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Slide\Note object passed."); + throw new \Exception("Invalid \PhpOffice\PhpPresentation\Slide\Note object passed."); } // Create XML writer diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Theme.php b/src/PhpPresentation/Writer/PowerPoint2007/Theme.php similarity index 66% rename from src/PhpPowerpoint/Writer/PowerPoint2007/Theme.php rename to src/PhpPresentation/Writer/PowerPoint2007/Theme.php index 6e5704f2a..f726a3a7f 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Theme.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Theme.php @@ -1,26 +1,26 @@ setPHPPowerPoint($pPHPPowerPoint); + // Assign PhpPresentation + $this->setPhpPresentation($pPhpPresentation); } /** - * Save PHPPowerPoint to file + * Save PhpPresentation to file * * @param string $pFilename * @throws \Exception @@ -77,66 +77,66 @@ public function save($pFilename) } } - // Add PHPPowerPoint.xml to the document, which represents a PHP serialized PHPPowerPoint object - $objZip->addFromString('PHPPowerPoint.xml', $this->writeSerialized($this->presentation, $pFilename)); + // Add PhpPresentation.xml to the document, which represents a PHP serialized PhpPresentation object + $objZip->addFromString('PhpPresentation.xml', $this->writeSerialized($this->presentation, $pFilename)); // Close file if ($objZip->close() === false) { throw new \Exception("Could not close zip file $pFilename."); } } else { - throw new \Exception("PHPPowerPoint object unassigned."); + throw new \Exception("PhpPresentation object unassigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @return PHPPowerPoint + * @return PhpPresentation * @throws \Exception */ - public function getPHPPowerPoint() + public function getPhpPresentation() { if (!is_null($this->presentation)) { return $this->presentation; } else { - throw new \Exception("No PHPPowerPoint assigned."); + throw new \Exception("No PhpPresentation assigned."); } } /** - * Get PHPPowerPoint object + * Get PhpPresentation object * - * @param PHPPowerPoint $pPHPPowerPoint PHPPowerPoint object + * @param PhpPresentation $pPhpPresentation PhpPresentation object * @throws \Exception - * @return \PhpOffice\PhpPowerpoint\Writer\Serialized + * @return \PhpOffice\PhpPresentation\Writer\Serialized */ - public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) + public function setPhpPresentation(PhpPresentation $pPhpPresentation = null) { - $this->presentation = $pPHPPowerPoint; + $this->presentation = $pPhpPresentation; return $this; } /** - * Serialize PHPPowerPoint object to XML + * Serialize PhpPresentation object to XML * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPresentation $pPhpPresentation * @param string $pFilename * @return string XML Output * @throws \Exception */ - private function writeSerialized(PhpPowerpoint $pPHPPowerPoint = null, $pFilename = '') + private function writeSerialized(PhpPresentation $pPhpPresentation = null, $pFilename = '') { - // Clone $pPHPPowerPoint - $pPHPPowerPoint = clone $pPHPPowerPoint; + // Clone $pPhpPresentation + $pPhpPresentation = clone $pPhpPresentation; // Update media links - $slideCount = $pPHPPowerPoint->getSlideCount(); + $slideCount = $pPhpPresentation->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { - for ($j = 0; $j < $pPHPPowerPoint->getSlide($i)->getShapeCollection()->count(); ++$j) { - if ($pPHPPowerPoint->getSlide($i)->getShapeCollection()->offsetGet($j) instanceof AbstractDrawing) { - $pPHPPowerPoint->getSlide($i)->getShapeCollection()->offsetGet($j)->setPath('zip://' . $pFilename . '#media/' . $pPHPPowerPoint->getSlide($i)->getShapeCollection()->offsetGet($j)->getFilename(), false); + for ($j = 0; $j < $pPhpPresentation->getSlide($i)->getShapeCollection()->count(); ++$j) { + if ($pPhpPresentation->getSlide($i)->getShapeCollection()->offsetGet($j) instanceof AbstractDrawing) { + $pPhpPresentation->getSlide($i)->getShapeCollection()->offsetGet($j)->setPath('zip://' . $pFilename . '#media/' . $pPhpPresentation->getSlide($i)->getShapeCollection()->offsetGet($j)->getFilename(), false); } } } @@ -149,16 +149,16 @@ private function writeSerialized(PhpPowerpoint $pPHPPowerPoint = null, $pFilenam // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); - // PHPPowerPoint - $objWriter->startElement('PHPPowerPoint'); + // PhpPresentation + $objWriter->startElement('PhpPresentation'); $objWriter->writeAttribute('version', '##VERSION##'); // Comment - $objWriter->writeComment('This file has been generated using PHPPowerPoint v##VERSION## (http://github.com/PHPOffice/PHPPowerPoint). It contains a base64 encoded serialized version of the PHPPowerPoint internal object.'); + $objWriter->writeComment('This file has been generated using PhpPresentation v##VERSION## (http://github.com/PHPOffice/PhpPresentation). It contains a base64 encoded serialized version of the PhpPresentation internal object.'); // Data $objWriter->startElement('data'); - $objWriter->writeCData(base64_encode(serialize($pPHPPowerPoint))); + $objWriter->writeCData(base64_encode(serialize($pPhpPresentation))); $objWriter->endElement(); $objWriter->endElement(); diff --git a/src/PhpPowerpoint/Writer/WriterInterface.php b/src/PhpPresentation/Writer/WriterInterface.php similarity index 54% rename from src/PhpPowerpoint/Writer/WriterInterface.php rename to src/PhpPresentation/Writer/WriterInterface.php index abd0c924d..bf63a35cf 100644 --- a/src/PhpPowerpoint/Writer/WriterInterface.php +++ b/src/PhpPresentation/Writer/WriterInterface.php @@ -1,21 +1,21 @@ assertNull($object->getSlide()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertEquals(0, $object->getHeight()); - $this->assertEquals(0, $object->getRotation()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getBorder()); - $this->assertEquals(Border::LINE_NONE, $object->getBorder()->getLineStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->getShadow()); - } - - public function testFill() - { - $object = new RichText(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setFill()); - $this->assertNull($object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setFill(new Fill())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); - } - - public function testHeight() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); - } - - public function testHyperlink() - { - $object = new RichText(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setHyperlink()); - $this->assertFalse($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->getHyperlink()); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->getHyperlink()); - $this->assertTrue($object->hasHyperlink()); - } - - public function testOffsetX() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); - } - - public function testOffsetY() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); - } - - public function testRotation() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setRotation()); - $this->assertEquals(0, $object->getRotation()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setRotation($value)); - $this->assertEquals($value, $object->getRotation()); - } - - public function testShadow() - { - $object = new RichText(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setShadow()); - $this->assertNull($object->getShadow()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setShadow(new Shadow())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->getShadow()); - } - - public function testSlide() - { - $object = new RichText(); - $oSlide1 = new Slide(); - $oSlide2 = new Slide(); - $oSlide3 = new Slide(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setSlide()); - $this->assertNull($object->getSlide()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setSlide($oSlide1, true)); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getSlide()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setSlide($oSlide2, true)); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getSlide()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setSlide($oSlide3, true)); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getSlide()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setSlide($oSlide3, true)); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getSlide()); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage A \PhpOffice\PhpPowerpoint\ShapeContainerInterface has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\ShapeContainerInterface. - */ - public function testSlideException() - { - $object = new RichText(); - $object->setSlide(new Slide()); - $object->setSlide(new Slide()); - } - - public function testWidth() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); - } - - public function testWidthAndHeight() - { - $object = new RichText(); - - $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight()); - $this->assertEquals(0, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight($value)); - $this->assertEquals($value, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight($value, $value)); - $this->assertEquals($value, $object->getWidth()); - $this->assertEquals($value, $object->getHeight()); - } -} diff --git a/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php b/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php deleted file mode 100644 index b36b2c4bd..000000000 --- a/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php +++ /dev/null @@ -1,106 +0,0 @@ -assertEquals('screen4x3', $object->getDocumentLayout()); - $this->assertEquals(9144000, $object->getCX()); - $this->assertEquals(6858000, $object->getCY()); - $this->assertEquals(9144000 / 36000, $object->getLayoutXmilli()); - $this->assertEquals(6858000 / 36000, $object->getLayoutYmilli()); - } - - /** - * Test set custom layout - */ - public function testSetCustomLayout() - { - $object = new DocumentLayout(); - $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), false); - $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()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php b/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php deleted file mode 100644 index 6edb548f8..000000000 --- a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php +++ /dev/null @@ -1,139 +0,0 @@ -assertTrue($object->canRead($file)); - } - - - /** - * Test cant read - */ - public function testCantRead() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; - $object = new PowerPoint97(); - - $this->assertFalse($object->canRead($file)); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Could not open for reading! File does not exist. - */ - public function testLoadFileNotExists() - { - $object = new PowerPoint97(); - $object->load(''); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\PowerPoint97: - */ - public function testLoadFileBadFormat() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_01_Simple.pptx'; - $object = new PowerPoint97(); - $object->load($file); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Could not open for reading! File does not exist. - */ - public function testFileSupportsNotExists() - { - $object = new PowerPoint97(); - $object->fileSupportsUnserializePHPPowerPoint(''); - } - - public function testLoadFile01() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; - $object = new PowerPoint97(); - $oPHPPowerPoint = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $oPHPPowerPoint); - $this->assertEquals(1, $oPHPPowerPoint->getSlideCount()); - - $oSlide = $oPHPPowerPoint->getSlide(0); - $this->assertCount(2, $oSlide->getShapeCollection()); - } - - public function testLoadFile02() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_02.ppt'; - $object = new PowerPoint97(); - $oPHPPowerPoint = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $oPHPPowerPoint); - $this->assertEquals(4, $oPHPPowerPoint->getSlideCount()); - - $oSlide = $oPHPPowerPoint->getSlide(0); - $this->assertCount(2, $oSlide->getShapeCollection()); - - $oSlide = $oPHPPowerPoint->getSlide(1); - $this->assertCount(3, $oSlide->getShapeCollection()); - - $oSlide = $oPHPPowerPoint->getSlide(2); - $this->assertCount(3, $oSlide->getShapeCollection()); - - $oSlide = $oPHPPowerPoint->getSlide(3); - $this->assertCount(3, $oSlide->getShapeCollection()); - } - - public function testLoadFile03() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_03.ppt'; - $object = new PowerPoint97(); - $oPHPPowerPoint = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $oPHPPowerPoint); - $this->assertEquals(1, $oPHPPowerPoint->getSlideCount()); - - $oSlide = $oPHPPowerPoint->getSlide(0); - $this->assertCount(1, $oSlide->getShapeCollection()); - } - - public function testLoadFile04() - { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_04.ppt'; - $object = new PowerPoint97(); - $oPHPPowerPoint = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $oPHPPowerPoint); - $this->assertEquals(1, $oPHPPowerPoint->getSlideCount()); - - $oSlide = $oPHPPowerPoint->getSlide(0); - $this->assertCount(4, $oSlide->getShapeCollection()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/AxisTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/AxisTest.php deleted file mode 100644 index 03eb335fe..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/AxisTest.php +++ /dev/null @@ -1,136 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getBorder()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - } - - public function testAlignment() - { - $object = new Legend(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setAlignment(new Alignment())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - } - - public function testFont() - { - $object = new Legend(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - } - - public function testHashIndex() - { - $object = new Legend(); - $value = rand(1, 100); - - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); - } - - public function testHeight() - { - $object = new Legend(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); - } - - public function testOffsetX() - { - $object = new Legend(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); - } - - public function testOffsetY() - { - $object = new Legend(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); - } - - public function testPosition() - { - $object = new Legend(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setPosition()); - $this->assertEquals(Legend::POSITION_RIGHT, $object->getPosition()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setPosition(Legend::POSITION_BOTTOM)); - $this->assertEquals(Legend::POSITION_BOTTOM, $object->getPosition()); - } - - public function testVisible() - { - $object = new Legend(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setVisible()); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setVisible(true)); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setVisible(false)); - $this->assertFalse($object->isVisible()); - } - - public function testWidth() - { - $object = new Legend(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/PlotAreaTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/PlotAreaTest.php deleted file mode 100644 index 39a2cc0e5..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/PlotAreaTest.php +++ /dev/null @@ -1,111 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->getAxisX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->getAxisY()); - } - - public function testHashIndex() - { - $object = new PlotArea(); - $value = rand(1, 100); - - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); - } - - public function testHeight() - { - $object = new PlotArea(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); - } - - public function testOffsetX() - { - $object = new PlotArea(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); - } - - public function testOffsetY() - { - $object = new PlotArea(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); - } - - public function testType() - { - $object = new PlotArea(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setType(new Bar3D())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\AbstractType', $object->getType()); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Chart type has not been set. - */ - public function testTypeException() - { - $object = new PlotArea(); - $object->getType(); - } - - public function testWidth() - { - $object = new PlotArea(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/TitleTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/TitleTest.php deleted file mode 100644 index 12a1eede9..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/TitleTest.php +++ /dev/null @@ -1,134 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - $this->assertEquals('Calibri', $object->getFont()->getName()); - $this->assertEquals(18, $object->getFont()->getSize()); - } - - public function testAlignment() - { - $object = new Title(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setAlignment(new Alignment())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - } - - public function testFont() - { - $object = new Title(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - } - - public function testHashIndex() - { - $object = new Title(); - $value = rand(1, 100); - - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); - } - - public function testHeight() - { - $object = new Title(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); - } - - public function testOffsetX() - { - $object = new Title(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetX()); - $this->assertEquals(0.01, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); - } - - public function testOffsetY() - { - $object = new Title(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetY()); - $this->assertEquals(0.01, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); - } - - public function testText() - { - $object = new Title(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setText()); - $this->assertNull($object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setText('AAAA')); - $this->assertEquals('AAAA', $object->getText()); - } - - public function testVisible() - { - $object = new Title(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setVisible()); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setVisible(true)); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setVisible(false)); - $this->assertFalse($object->isVisible()); - } - - public function testWidth() - { - $object = new Title(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/View3DTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/View3DTest.php deleted file mode 100644 index 9368fa7ff..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/View3DTest.php +++ /dev/null @@ -1,105 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setDepthPercent()); - $this->assertEquals(100, $object->getDepthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setDepthPercent($value)); - $this->assertEquals($value, $object->getDepthPercent()); - } - - public function testHashIndex() - { - $object = new View3D(); - $value = rand(1, 100); - - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); - } - - public function testHeightPercent() - { - $object = new View3D(); - $value = rand(5, 500); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setHeightPercent()); - $this->assertEquals(100, $object->getHeightPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setHeightPercent($value)); - $this->assertEquals($value, $object->getHeightPercent()); - } - - public function testPerspective() - { - $object = new View3D(); - $value = rand(0, 100); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setPerspective()); - $this->assertEquals(30, $object->getPerspective()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setPerspective($value)); - $this->assertEquals($value, $object->getPerspective()); - } - - public function testRightAngleAxes() - { - $object = new View3D(); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRightAngleAxes()); - $this->assertTrue($object->hasRightAngleAxes()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRightAngleAxes(true)); - $this->assertTrue($object->hasRightAngleAxes()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRightAngleAxes(false)); - $this->assertFalse($object->hasRightAngleAxes()); - } - - public function testRotationX() - { - $object = new View3D(); - $value = rand(-90, 90); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRotationX()); - $this->assertEquals(0, $object->getRotationX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRotationX($value)); - $this->assertEquals($value, $object->getRotationX()); - } - - public function testRotationY() - { - $object = new View3D(); - $value = rand(-90, 90); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRotationY()); - $this->assertEquals(0, $object->getRotationY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->setRotationY($value)); - $this->assertEquals($value, $object->getRotationY()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/ChartTest.php b/tests/PhpPowerpoint/Tests/Shape/ChartTest.php deleted file mode 100644 index fdce9d58b..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/ChartTest.php +++ /dev/null @@ -1,65 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->getTitle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $object->getLegend()); - $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() - { - $object = new Chart(); - - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart', $object->setIncludeSpreadsheet()); - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart', $object->setIncludeSpreadsheet(false)); - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart', $object->setIncludeSpreadsheet(true)); - $this->assertTrue($object->hasIncludedSpreadsheet()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shape/RichText/ParagraphTest.php b/tests/PhpPowerpoint/Tests/Shape/RichText/ParagraphTest.php deleted file mode 100644 index db05d45b4..000000000 --- a/tests/PhpPowerpoint/Tests/Shape/RichText/ParagraphTest.php +++ /dev/null @@ -1,151 +0,0 @@ -assertEmpty($object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->getBulletStyle()); - } - - public function testAlignment() - { - $object = new Paragraph(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setAlignment(new Alignment())); - } - - /** - * Test get/set bullet style - */ - public function testBulletStyle() - { - $object = new Paragraph(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->getBulletStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setBulletStyle()); - $this->assertNull($object->getBulletStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setBulletStyle(new Bullet())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->getBulletStyle()); - } - - /** - * Test get/set font - */ - public function testFont() - { - $object = new Paragraph(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); - } - - /** - * Test get/set hashCode - */ - public function testHashCode() - { - $object = new Paragraph(); - $oElement = new TextElement(); - $object->addText($oElement); - $this->assertEquals(md5($oElement->getHashCode().$object->getFont()->getHashCode().get_class($object)), $object->getHashCode()); - } - - /** - * Test get/set hashIndex - */ - public function testHashIndex() - { - $object = new Paragraph(); - $value = rand(1, 100); - $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); - } - - /** - * Test get/set richTextElements - */ - public function testRichTextElements() - { - $object = new Paragraph(); - $this->assertInternalType('array', $object->getRichTextElements()); - $this->assertEmpty($object->getRichTextElements()); - $object->createBreak(); - $this->assertCount(1, $object->getRichTextElements()); - - $array = array( - new TextElement(), - new TextElement(), - new TextElement(), - ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setRichTextElements($array)); - $this->assertCount(3, $object->getRichTextElements()); - } - - /** - * @expectedException \Exception - * expectedExceptionMessage Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\TextElementInterface[] array passed. - */ - public function testRichTextElementsException() - { - $object = new Paragraph(); - $object->setRichTextElements(1); - } - - /** - * Test text methods - */ - public function testText() - { - $object = new Paragraph(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->addText(new TextElement())); - $this->assertcount(1, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText()); - $this->assertcount(2, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText('AAA')); - $this->assertcount(3, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->createBreak()); - $this->assertcount(4, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun()); - $this->assertcount(5, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun('BBB')); - $this->assertcount(6, $object->getRichTextElements()); - $this->assertEquals('AAA'."\r\n".'BBB', $object->getPlainText()); - $this->assertEquals('AAA'."\r\n".'BBB', (string) $object); - } -} diff --git a/tests/PhpPowerpoint/Tests/Slide/IteratorTest.php b/tests/PhpPowerpoint/Tests/Slide/IteratorTest.php deleted file mode 100644 index f63c1676a..000000000 --- a/tests/PhpPowerpoint/Tests/Slide/IteratorTest.php +++ /dev/null @@ -1,51 +0,0 @@ -addSlide(new Slide()); - - $object = new Iterator($oPHPPowerPoint); - - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->current()); - $this->assertEquals(0, $object->key()); - $this->assertNull($object->next()); - $this->assertEquals(1, $object->key()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->current()); - $this->assertTrue($object->valid()); - $this->assertNull($object->next()); - $this->assertFalse($object->valid()); - $this->assertNull($object->rewind()); - $this->assertEquals(0, $object->key()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php deleted file mode 100644 index 67065889a..000000000 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php +++ /dev/null @@ -1,55 +0,0 @@ -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/ContenTypesTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php deleted file mode 100644 index 672fb28a2..000000000 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php +++ /dev/null @@ -1,50 +0,0 @@ -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 deleted file mode 100644 index a85c220d4..000000000 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/DrawingTest.php +++ /dev/null @@ -1,55 +0,0 @@ -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/SerializedTest.php b/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php deleted file mode 100644 index 233c086ae..000000000 --- a/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php +++ /dev/null @@ -1,109 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $object->getPHPPowerPoint()); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage No PHPPowerPoint assigned. - */ - public function testEmptyConstruct() - { - $object = new Serialized(); - $object->getPHPPowerPoint(); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Filename is empty. - */ - public function testSaveEmpty() - { - $object = new Serialized(new PhpPowerpoint()); - $object->save(''); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage PHPPowerPoint object unassigned. - */ - public function testSaveNoObject() - { - $object = new Serialized(); - $object->save('file.phpppt'); - } - - public function testSave() - { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); - $oImage = $oSlide->createDrawingShape(); - $oImage->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png'); - $object = new Serialized($oPHPPowerPoint); - - $file = tempnam(sys_get_temp_dir(), 'PhpPowerpoint_Serialized'); - - $this->assertFileExists($file, $object->save($file)); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Could not open - */ - public function testSaveNotExistingDir() - { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); - $oImage = $oSlide->createDrawingShape(); - $oImage->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png'); - $object = new Serialized($oPHPPowerPoint); - - $file = tempnam(sys_get_temp_dir(), 'PhpPowerpoint_Serialized'); - - $this->assertFileExists($file, $object->save($file.DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR.'test')); - } - - public function testSaveOverwriting() - { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); - $oImage = $oSlide->createDrawingShape(); - $oImage->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png'); - $object = new Serialized($oPHPPowerPoint); - - $file = tempnam(sys_get_temp_dir(), 'PhpPowerpoint_Serialized'); - file_put_contents($file, rand(1, 100)); - - $this->assertFileExists($file, $object->save($file)); - } -} diff --git a/tests/PhpPresentation/Tests/AbstractShapeTest.php b/tests/PhpPresentation/Tests/AbstractShapeTest.php new file mode 100644 index 000000000..345366d0d --- /dev/null +++ b/tests/PhpPresentation/Tests/AbstractShapeTest.php @@ -0,0 +1,154 @@ +assertEquals(0, $object->getOffsetX()); + $this->assertEquals(0, $object->getOffsetY()); + $this->assertEquals(0, $object->getHeight()); + $this->assertEquals(0, $object->getRotation()); + $this->assertEquals(0, $object->getWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); + $this->assertEquals(Border::LINE_NONE, $object->getBorder()->getLineStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->getShadow()); + } + + public function testFill() + { + $object = new RichText(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setFill()); + $this->assertNull($object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setFill(new Fill())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + } + + public function testHeight() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setHeight()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setHeight($value)); + $this->assertEquals($value, $object->getHeight()); + } + + public function testHyperlink() + { + $object = new RichText(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setHyperlink()); + $this->assertFalse($object->hasHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); + $this->assertTrue($object->hasHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); + $this->assertTrue($object->hasHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); + $this->assertTrue($object->hasHyperlink()); + } + + public function testOffsetX() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setOffsetX()); + $this->assertEquals(0, $object->getOffsetX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setOffsetX($value)); + $this->assertEquals($value, $object->getOffsetX()); + } + + public function testOffsetY() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setOffsetY()); + $this->assertEquals(0, $object->getOffsetY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setOffsetY($value)); + $this->assertEquals($value, $object->getOffsetY()); + } + + public function testRotation() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setRotation()); + $this->assertEquals(0, $object->getRotation()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setRotation($value)); + $this->assertEquals($value, $object->getRotation()); + } + + public function testShadow() + { + $object = new RichText(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setShadow()); + $this->assertNull($object->getShadow()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setShadow(new Shadow())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->getShadow()); + } + + public function testWidth() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setWidth()); + $this->assertEquals(0, $object->getWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setWidth($value)); + $this->assertEquals($value, $object->getWidth()); + } + + public function testWidthAndHeight() + { + $object = new RichText(); + + $value = rand(1, 100); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setWidthAndHeight()); + $this->assertEquals(0, $object->getWidth()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setWidthAndHeight($value)); + $this->assertEquals($value, $object->getWidth()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\AbstractShape', $object->setWidthAndHeight($value, $value)); + $this->assertEquals($value, $object->getWidth()); + $this->assertEquals($value, $object->getHeight()); + } +} diff --git a/tests/PhpPowerpoint/Tests/AutoloaderTest.php b/tests/PhpPresentation/Tests/AutoloaderTest.php similarity index 58% rename from tests/PhpPowerpoint/Tests/AutoloaderTest.php rename to tests/PhpPresentation/Tests/AutoloaderTest.php index 583170f25..31fd2c99e 100644 --- a/tests/PhpPowerpoint/Tests/AutoloaderTest.php +++ b/tests/PhpPresentation/Tests/AutoloaderTest.php @@ -1,23 +1,23 @@ assertContains( - array('PhpOffice\\PhpPowerpoint\\Autoloader', 'autoload'), + array('PhpOffice\\PhpPresentation\\Autoloader', 'autoload'), spl_autoload_functions() ); } @@ -47,8 +47,8 @@ public function testAutoload() $this->assertEquals( $declaredCount, count(get_declared_classes()), - 'PhpOffice\\PhpPowerpoint\\Autoloader::autoload() is trying to load ' . - 'classes outside of the PhpOffice\\PhpPowerpoint namespace' + 'PhpOffice\\PhpPresentation\\Autoloader::autoload() is trying to load ' . + 'classes outside of the PhpOffice\\PhpPresentation namespace' ); } } diff --git a/tests/PhpPresentation/Tests/DocumentLayoutTest.php b/tests/PhpPresentation/Tests/DocumentLayoutTest.php new file mode 100644 index 000000000..bbbc6e86e --- /dev/null +++ b/tests/PhpPresentation/Tests/DocumentLayoutTest.php @@ -0,0 +1,96 @@ +assertEquals('screen4x3', $object->getDocumentLayout()); + $this->assertEquals(9144000, $object->getCX()); + $this->assertEquals(6858000, $object->getCY()); + } + + /** + * Test set custom layout + */ + public function testSetCustomLayout() + { + $object = new DocumentLayout(); + $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), false); + $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\\PhpPresentation\\DocumentLayout', $object->setCX($value)); + $this->assertEquals($value, $object->getCX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_CENTIMETER)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_CENTIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_EMU)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_EMU)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_INCH)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_INCH)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_POINT)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_POINT)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_PIXEL)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_PIXEL)); + } + + public function testCY() + { + $value = rand(1, 100000); + $object = new DocumentLayout(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value)); + $this->assertEquals($value, $object->getCY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_CENTIMETER)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_CENTIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_EMU)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_EMU)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_INCH)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_INCH)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_POINT)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_POINT)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_PIXEL)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_PIXEL)); + } +} diff --git a/tests/PhpPowerpoint/Tests/DocumentPropertiesTest.php b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php similarity index 75% rename from tests/PhpPowerpoint/Tests/DocumentPropertiesTest.php rename to tests/PhpPresentation/Tests/DocumentPropertiesTest.php index 3ff35f96a..34a2db853 100644 --- a/tests/PhpPowerpoint/Tests/DocumentPropertiesTest.php +++ b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php @@ -1,28 +1,28 @@ assertInstanceOf($class, IOFactory::createWriter(new PhpPowerpoint())); + $this->assertInstanceOf($class, IOFactory::createWriter(new PhpPresentation())); } /** @@ -42,7 +42,7 @@ public function testCreateWriter() */ public function testCreateReader() { - $class = 'PhpOffice\\PhpPowerpoint\\Reader\\ReaderInterface'; + $class = 'PhpOffice\\PhpPresentation\\Reader\\ReaderInterface'; $this->assertInstanceOf($class, IOFactory::createReader('Serialized')); } @@ -60,17 +60,17 @@ public function testLoadClassException() public function testLoad() { - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', IOFactory::load(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.'serialized.phppt')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', IOFactory::load(PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.'serialized.phppt')); } /** * Test load class exception * * @expectedException \Exception - * @expectedExceptionMessage Could not automatically determine \PhpOffice\PhpPowerpoint\Reader\ReaderInterface for file. + * @expectedExceptionMessage Could not automatically determine \PhpOffice\PhpPresentation\Reader\ReaderInterface for file. */ public function testLoadException() { - IOFactory::load(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png'); + IOFactory::load(PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PhpPresentationLogo.png'); } } diff --git a/tests/PhpPowerpoint/Tests/PhpPowerpointTest.php b/tests/PhpPresentation/Tests/PhpPowerpointTest.php similarity index 61% rename from tests/PhpPowerpoint/Tests/PhpPowerpointTest.php rename to tests/PhpPresentation/Tests/PhpPowerpointTest.php index a95b7f500..228e58d47 100644 --- a/tests/PhpPowerpoint/Tests/PhpPowerpointTest.php +++ b/tests/PhpPresentation/Tests/PhpPowerpointTest.php @@ -1,49 +1,49 @@ getSlide(); $this->assertEquals(new DocumentProperties(), $object->getProperties()); $this->assertEquals(new DocumentLayout(), $object->getLayout()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getSlide()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getSlide()); $this->assertEquals(1, count($object->getAllSlides())); $this->assertEquals(0, $object->getIndex($slide)); $this->assertEquals(1, $object->getSlideCount()); $this->assertEquals(0, $object->getActiveSlideIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Iterator', $object->getSlideIterator()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Iterator', $object->getSlideIterator()); } /** @@ -51,9 +51,9 @@ public function testConstruct() */ public function testAddExternalSlide() { - $origin = new PhpPowerpoint(); + $origin = new PhpPresentation(); $slide = $origin->getSlide(); - $object = new PhpPowerpoint(); + $object = new PhpPresentation(); $object->addExternalSlide($slide); $this->assertEquals(2, $object->getSlideCount()); @@ -64,8 +64,8 @@ public function testAddExternalSlide() */ public function testCopy() { - $object = new PhpPowerpoint(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $object->copy()); + $object = new PhpPresentation(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->copy()); } /** @@ -76,7 +76,7 @@ public function testCopy() */ public function testRemoveSlideByIndexException() { - $object = new PhpPowerpoint(); + $object = new PhpPresentation(); $object->removeSlideByIndex(1); } @@ -88,7 +88,7 @@ public function testRemoveSlideByIndexException() */ public function testGetSlideException() { - $object = new PhpPowerpoint(); + $object = new PhpPresentation(); $object->getSlide(1); } @@ -100,7 +100,7 @@ public function testGetSlideException() */ public function testSetActiveSlideIndexException() { - $object = new PhpPowerpoint(); + $object = new PhpPresentation(); $object->setActiveSlideIndex(1); } } diff --git a/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php b/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php new file mode 100644 index 000000000..9b866fd4b --- /dev/null +++ b/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php @@ -0,0 +1,467 @@ +assertFalse($object->canRead($file)); + + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; + $this->assertFalse($object->canRead($file)); + + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; + $this->assertFalse($object->canRead($file)); + + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp'; + $this->assertTrue($object->canRead($file)); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testLoadFileNotExists() + { + $object = new ODPresentation(); + $object->load(''); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\ODPresentation: + */ + public function testLoadFileBadFormat() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; + $object = new ODPresentation(); + $object->load($file); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testFileSupportsNotExists() + { + $object = new ODPresentation(); + $object->fileSupportsUnserializePhpPresentation(''); + } + + public function testLoadFile01() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp'; + $object = new ODPresentation(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + // Document Properties + $this->assertEquals('PHPOffice', $oPhpPresentation->getProperties()->getCreator()); + $this->assertEquals('PHPPresentation Team', $oPhpPresentation->getProperties()->getLastModifiedBy()); + $this->assertEquals('Sample 02 Title', $oPhpPresentation->getProperties()->getTitle()); + $this->assertEquals('Sample 02 Subject', $oPhpPresentation->getProperties()->getSubject()); + $this->assertEquals('Sample 02 Description', $oPhpPresentation->getProperties()->getDescription()); + $this->assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getProperties()->getKeywords()); + // + $this->assertCount(4, $oPhpPresentation->getAllSlides()); + + // Slide 1 + $oSlide1 = $oPhpPresentation->getSlide(0); + $arrayShape = $oSlide1->getShapeCollection(); + $this->assertCount(2, $arrayShape); + // Slide 1 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 1 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(200, $oShape->getHeight()); + $this->assertEquals(600, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(400, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(3, $arrayRichText); + // Slide 1 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Introduction to', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(28, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 1 : Shape 2 : Paragraph 2 + $oRichText = $arrayRichText[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + // Slide 1 : Shape 2 : Paragraph 3 + $oRichText = $arrayRichText[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('PHPPresentation', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(60, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 2 + $oSlide2 = $oPhpPresentation->getSlide(1); + $arrayShape = $oSlide2->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 2 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 2 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 2 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('What is PHPPresentation?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(4, $arrayParagraphs); + // Slide 2 : Shape 3 : Paragraph 1 + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('A class library', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 2 + $oParagraph = $arrayParagraphs[1]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Written in PHP', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 3 + $oParagraph = $arrayParagraphs[2]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Representing a presentation', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 4 + $oParagraph = $arrayParagraphs[3]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Supports writing to different file formats', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 3 + $oSlide2 = $oPhpPresentation->getSlide(2); + $arrayShape = $oSlide2->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 3 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 3 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 3 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('What\'s the point?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 2 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(8, $arrayParagraphs); + // Slide 3 : Shape 3 : Paragraph 1 + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Generate slide decks', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 2 + $oParagraph = $arrayParagraphs[1]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Represent business data', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 3 + $oParagraph = $arrayParagraphs[2]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Show a family slide show', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 4 + $oParagraph = $arrayParagraphs[3]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('...', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 5 + $oParagraph = $arrayParagraphs[4]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Export these to different formats', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 6 + $oParagraph = $arrayParagraphs[5]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('PHPPresentation 2007', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 7 + $oParagraph = $arrayParagraphs[6]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Serialized', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 8 + $oParagraph = $arrayParagraphs[7]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); +// $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); +// $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('... (more to come) ...', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 4 + $oSlide3 = $oPhpPresentation->getSlide(3); + $arrayShape = $oSlide3->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 4 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 4 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 4 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Need more info?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + // Slide 4 : Shape 3 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(3, $arrayRichText); + // Slide 4 : Shape 3 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Check the project site on GitHub:', $oRichText->getText()); + $this->assertFalse($oRichText->getFont()->isBold()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + // Slide 4 : Shape 3 : Paragraph 2 + $oRichText = $arrayRichText[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + // Slide 4 : Shape 3 : Paragraph 3 + $oRichText = $arrayRichText[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); + $this->assertFalse($oRichText->getFont()->isBold()); + $this->assertEquals(32, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + $this->assertTrue($oRichText->hasHyperlink()); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); + //$this->assertEquals('PHPPresentation', $oRichText->getHyperlink()->getTooltip()); + } +} diff --git a/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php b/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php new file mode 100644 index 000000000..9f0ceb651 --- /dev/null +++ b/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php @@ -0,0 +1,465 @@ +assertFalse($object->canRead($file)); + + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; + $this->assertFalse($object->canRead($file)); + + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; + $this->assertTrue($object->canRead($file)); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testLoadFileNotExists() + { + $object = new PowerPoint2007(); + $object->load(''); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint2007: + */ + public function testLoadFileBadFormat() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; + $object = new PowerPoint2007(); + $object->load($file); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testFileSupportsNotExists() + { + $object = new PowerPoint2007(); + $object->fileSupportsUnserializePhpPresentation(''); + } + + public function testLoadFile01() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; + $object = new PowerPoint2007(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + // Document Properties + $this->assertEquals('PHPOffice', $oPhpPresentation->getProperties()->getCreator()); + $this->assertEquals('PHPPresentation Team', $oPhpPresentation->getProperties()->getLastModifiedBy()); + $this->assertEquals('Sample 02 Title', $oPhpPresentation->getProperties()->getTitle()); + $this->assertEquals('Sample 02 Subject', $oPhpPresentation->getProperties()->getSubject()); + $this->assertEquals('Sample 02 Description', $oPhpPresentation->getProperties()->getDescription()); + $this->assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getProperties()->getKeywords()); + $this->assertEquals('Sample Category', $oPhpPresentation->getProperties()->getCategory()); + // + $this->assertCount(4, $oPhpPresentation->getAllSlides()); + + // Slide 1 + $oSlide1 = $oPhpPresentation->getSlide(0); + $arrayShape = $oSlide1->getShapeCollection(); + $this->assertCount(2, $arrayShape); + // Slide 1 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 1 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(200, $oShape->getHeight()); + $this->assertEquals(600, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(400, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(3, $arrayRichText); + // Slide 1 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Introduction to', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(28, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 1 : Shape 2 : Paragraph 2 + $oRichText = $arrayRichText[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + // Slide 1 : Shape 2 : Paragraph 3 + $oRichText = $arrayRichText[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('PHPPresentation', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(60, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 2 + $oSlide2 = $oPhpPresentation->getSlide(1); + $arrayShape = $oSlide2->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 2 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 2 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 2 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('What is PHPPresentation?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(4, $arrayParagraphs); + // Slide 2 : Shape 3 : Paragraph 1 + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('A class library', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 2 + $oParagraph = $arrayParagraphs[1]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Written in PHP', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 3 + $oParagraph = $arrayParagraphs[2]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Representing a presentation', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 2 : Shape 3 : Paragraph 4 + $oParagraph = $arrayParagraphs[3]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Supports writing to different file formats', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 3 + $oSlide2 = $oPhpPresentation->getSlide(2); + $arrayShape = $oSlide2->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 3 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 3 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 3 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('What\'s the point?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 2 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(8, $arrayParagraphs); + // Slide 3 : Shape 3 : Paragraph 1 + $oParagraph = $arrayParagraphs[0]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Generate slide decks', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 2 + $oParagraph = $arrayParagraphs[1]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Represent business data', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 3 + $oParagraph = $arrayParagraphs[2]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Show a family slide show', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 4 + $oParagraph = $arrayParagraphs[3]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('...', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 5 + $oParagraph = $arrayParagraphs[4]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Export these to different formats', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 6 + $oParagraph = $arrayParagraphs[5]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('PHPPresentation 2007', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 7 + $oParagraph = $arrayParagraphs[6]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Serialized', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + // Slide 3 : Shape 3 : Paragraph 8 + $oParagraph = $arrayParagraphs[7]; + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); + $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('... (more to come) ...', $oRichText->getText()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + + // Slide 4 + $oSlide3 = $oPhpPresentation->getSlide(3); + $arrayShape = $oSlide3->getShapeCollection(); + $this->assertCount(3, $arrayShape); + // Slide 4 : Shape 1 + $oShape = $arrayShape[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $oShape); + $this->assertEquals('PHPPresentation logo', $oShape->getName()); + $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); + $this->assertEquals(36, $oShape->getHeight()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(10, $oShape->getOffsetY()); + $this->assertTrue($oShape->getShadow()->isVisible()); + $this->assertEquals(45, $oShape->getShadow()->getDirection()); + $this->assertEquals(10, $oShape->getShadow()->getDistance()); + // Slide 4 : Shape 2 + $oShape = $arrayShape[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(100, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(50, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(1, $arrayRichText); + // Slide 4 : Shape 2 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Need more info?', $oRichText->getText()); + $this->assertTrue($oRichText->getFont()->isBold()); + $this->assertEquals(48, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + // Slide 4 : Shape 3 + $oShape = $arrayShape[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $oShape); + $this->assertEquals(600, $oShape->getHeight()); + $this->assertEquals(930, $oShape->getWidth()); + $this->assertEquals(10, $oShape->getOffsetX()); + $this->assertEquals(130, $oShape->getOffsetY()); + $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oShape->getActiveParagraph()->getAlignment()->getHorizontal()); + $arrayParagraphs = $oShape->getParagraphs(); + $this->assertCount(1, $arrayParagraphs); + $oParagraph = $arrayParagraphs[0]; + $arrayRichText = $oParagraph->getRichTextElements(); + $this->assertCount(3, $arrayRichText); + // Slide 4 : Shape 3 : Paragraph 1 + $oRichText = $arrayRichText[0]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('Check the project site on GitHub:', $oRichText->getText()); + $this->assertFalse($oRichText->getFont()->isBold()); + $this->assertEquals(36, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + // Slide 4 : Shape 3 : Paragraph 2 + $oRichText = $arrayRichText[1]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + // Slide 4 : Shape 3 : Paragraph 3 + $oRichText = $arrayRichText[2]; + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); + $this->assertFalse($oRichText->getFont()->isBold()); + $this->assertEquals(32, $oRichText->getFont()->getSize()); + $this->assertEquals('FF000000', $oShape->getActiveParagraph()->getFont()->getColor()->getARGB()); + $this->assertTrue($oRichText->hasHyperlink()); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); + $this->assertEquals('PHPPresentation', $oRichText->getHyperlink()->getTooltip()); + } +} diff --git a/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php b/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php new file mode 100644 index 000000000..12aa1a6c1 --- /dev/null +++ b/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php @@ -0,0 +1,139 @@ +assertTrue($object->canRead($file)); + } + + + /** + * Test cant read + */ + public function testCantRead() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; + $object = new PowerPoint97(); + + $this->assertFalse($object->canRead($file)); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testLoadFileNotExists() + { + $object = new PowerPoint97(); + $object->load(''); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint97: + */ + public function testLoadFileBadFormat() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_01_Simple.pptx'; + $object = new PowerPoint97(); + $object->load($file); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open for reading! File does not exist. + */ + public function testFileSupportsNotExists() + { + $object = new PowerPoint97(); + $object->fileSupportsUnserializePhpPresentation(''); + } + + public function testLoadFile01() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; + $object = new PowerPoint97(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + + $oSlide = $oPhpPresentation->getSlide(0); + $this->assertCount(2, $oSlide->getShapeCollection()); + } + + public function testLoadFile02() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_02.ppt'; + $object = new PowerPoint97(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + $this->assertEquals(4, $oPhpPresentation->getSlideCount()); + + $oSlide = $oPhpPresentation->getSlide(0); + $this->assertCount(2, $oSlide->getShapeCollection()); + + $oSlide = $oPhpPresentation->getSlide(1); + $this->assertCount(3, $oSlide->getShapeCollection()); + + $oSlide = $oPhpPresentation->getSlide(2); + $this->assertCount(3, $oSlide->getShapeCollection()); + + $oSlide = $oPhpPresentation->getSlide(3); + $this->assertCount(3, $oSlide->getShapeCollection()); + } + + public function testLoadFile03() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_03.ppt'; + $object = new PowerPoint97(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + + $oSlide = $oPhpPresentation->getSlide(0); + $this->assertCount(1, $oSlide->getShapeCollection()); + } + + public function testLoadFile04() + { + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_04.ppt'; + $object = new PowerPoint97(); + $oPhpPresentation = $object->load($file); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + + $oSlide = $oPhpPresentation->getSlide(0); + $this->assertCount(4, $oSlide->getShapeCollection()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php b/tests/PhpPresentation/Tests/Reader/SerializedTest.php similarity index 63% rename from tests/PhpPowerpoint/Tests/Reader/SerializedTest.php rename to tests/PhpPresentation/Tests/Reader/SerializedTest.php index ae218b2c4..6f7bbfddd 100644 --- a/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php +++ b/tests/PhpPresentation/Tests/Reader/SerializedTest.php @@ -1,28 +1,28 @@ assertTrue($object->canRead($file)); @@ -49,11 +49,11 @@ public function testLoadFileNotExists() /** * @expectedException \Exception - * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\Serialized: */ public function testLoadFileBadFormat() { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_01_Simple.pptx'; + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_01_Simple.pptx'; $object = new Serialized(); $object->load($file); } @@ -65,15 +65,15 @@ public function testLoadFileBadFormat() public function testFileSupportsNotExists() { $object = new Serialized(); - $object->fileSupportsUnserializePHPPowerPoint(''); + $object->fileSupportsUnserializePhpPresentation(''); } public function testLoadSerializedFileNotExists() { - $file = tempnam(sys_get_temp_dir(), 'PhpPowerpoint_Serialized'); + $file = tempnam(sys_get_temp_dir(), 'PhpPresentation_Serialized'); $oArchive = new \ZipArchive(); $oArchive->open($file, \ZipArchive::CREATE); - $oArchive->addFromString('PHPPowerPoint.xml', ''); + $oArchive->addFromString('PhpPresentation.xml', ''); $oArchive->close(); $object = new Serialized(); diff --git a/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php b/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php new file mode 100644 index 000000000..416450149 --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php @@ -0,0 +1,136 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + } + + public function testAlignment() + { + $object = new Legend(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setAlignment(new Alignment())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + } + + public function testFont() + { + $object = new Legend(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont()); + $this->assertNull($object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont(new Font())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + } + + public function testHashIndex() + { + $object = new Legend(); + $value = rand(1, 100); + + $this->assertEmpty($object->getHashIndex()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHashIndex($value)); + $this->assertEquals($value, $object->getHashIndex()); + } + + public function testHeight() + { + $object = new Legend(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight($value)); + $this->assertEquals($value, $object->getHeight()); + } + + public function testOffsetX() + { + $object = new Legend(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX()); + $this->assertEquals(0, $object->getOffsetX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX($value)); + $this->assertEquals($value, $object->getOffsetX()); + } + + public function testOffsetY() + { + $object = new Legend(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY()); + $this->assertEquals(0, $object->getOffsetY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY($value)); + $this->assertEquals($value, $object->getOffsetY()); + } + + public function testPosition() + { + $object = new Legend(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition()); + $this->assertEquals(Legend::POSITION_RIGHT, $object->getPosition()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition(Legend::POSITION_BOTTOM)); + $this->assertEquals(Legend::POSITION_BOTTOM, $object->getPosition()); + } + + public function testVisible() + { + $object = new Legend(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible()); + $this->assertTrue($object->isVisible()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(true)); + $this->assertTrue($object->isVisible()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(false)); + $this->assertFalse($object->isVisible()); + } + + public function testWidth() + { + $object = new Legend(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth()); + $this->assertEquals(0, $object->getWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth($value)); + $this->assertEquals($value, $object->getWidth()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/LegendTest.php b/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php similarity index 55% rename from tests/PhpPowerpoint/Tests/Shape/Chart/LegendTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php index 0c62436c7..9ee1858b0 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/LegendTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->setFormatCode()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFormatCode()); $this->assertEquals('', $object->getFormatCode()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->setFormatCode('AAAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFormatCode('AAAA')); $this->assertEquals('AAAA', $object->getFormatCode()); } @@ -48,7 +48,7 @@ public function testHashIndex() $value = rand(1, 100); $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->setHashIndex($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setHashIndex($value)); $this->assertEquals($value, $object->getHashIndex()); } @@ -56,7 +56,7 @@ public function testTitle() { $object = new Axis(); $this->assertEquals('Axis Title', $object->getTitle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Axis', $object->setTitle('AAAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setTitle('AAAA')); $this->assertEquals('AAAA', $object->getTitle()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php b/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php new file mode 100644 index 000000000..7a0c2fd2d --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php @@ -0,0 +1,111 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->getAxisX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->getAxisY()); + } + + public function testHashIndex() + { + $object = new PlotArea(); + $value = rand(1, 100); + + $this->assertEmpty($object->getHashIndex()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setHashIndex($value)); + $this->assertEquals($value, $object->getHashIndex()); + } + + public function testHeight() + { + $object = new PlotArea(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setHeight()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setHeight($value)); + $this->assertEquals($value, $object->getHeight()); + } + + public function testOffsetX() + { + $object = new PlotArea(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setOffsetX()); + $this->assertEquals(0, $object->getOffsetX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setOffsetX($value)); + $this->assertEquals($value, $object->getOffsetX()); + } + + public function testOffsetY() + { + $object = new PlotArea(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setOffsetY()); + $this->assertEquals(0, $object->getOffsetY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setOffsetY($value)); + $this->assertEquals($value, $object->getOffsetY()); + } + + public function testType() + { + $object = new PlotArea(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setType(new Bar3D())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\AbstractType', $object->getType()); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Chart type has not been set. + */ + public function testTypeException() + { + $object = new PlotArea(); + $object->getType(); + } + + public function testWidth() + { + $object = new PlotArea(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setWidth()); + $this->assertEquals(0, $object->getWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->setWidth($value)); + $this->assertEquals($value, $object->getWidth()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php b/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php similarity index 53% rename from tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php index 93e3c8272..a5f440437 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php @@ -1,30 +1,30 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); $this->assertEquals('Calibri', $object->getFont()->getName()); $this->assertEquals(9, $object->getFont()->getSize()); $this->assertEquals('Series Title', $object->getTitle()); @@ -48,12 +48,12 @@ public function testDataLabelNumFormat() $this->assertEmpty($object->getDlblNumFormat()); $this->assertFalse($object->hasDlblNumFormat()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setDlblNumFormat('#%')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setDlblNumFormat('#%')); $this->assertEquals('#%', $object->getDlblNumFormat()); $this->assertTrue($object->hasDlblNumFormat()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setDlblNumFormat()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setDlblNumFormat()); $this->assertEmpty($object->getDlblNumFormat()); $this->assertFalse($object->hasDlblNumFormat()); @@ -66,27 +66,27 @@ public function testDataPointFills() $this->assertInternalType('array', $object->getDataPointFills()); $this->assertEmpty($object->getDataPointFills()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getDataPointFill(0)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getDataPointFill(0)); } public function testFill() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\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()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setFill(new Fill())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testFont() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setFont()); $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setFont(new Font())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testHashIndex() @@ -95,7 +95,7 @@ public function testHashIndex() $value = rand(1, 100); $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setHashIndex($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setHashIndex($value)); $this->assertEquals($value, $object->getHashIndex()); } @@ -111,7 +111,7 @@ public function testLabelPosition() $object = new Series(); $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setLabelPosition(Series::LABEL_INSIDEBASE)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setLabelPosition(Series::LABEL_INSIDEBASE)); $this->assertEquals(Series::LABEL_INSIDEBASE, $object->getLabelPosition()); } @@ -119,9 +119,9 @@ public function testShowCategoryName() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowCategoryName(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowCategoryName(true)); $this->assertTrue($object->hasShowCategoryName()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowCategoryName(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowCategoryName(false)); $this->assertFalse($object->hasShowCategoryName()); } @@ -129,9 +129,9 @@ public function testShowLeaderLines() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowLeaderLines(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowLeaderLines(true)); $this->assertTrue($object->hasShowLeaderLines()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowLeaderLines(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowLeaderLines(false)); $this->assertFalse($object->hasShowLeaderLines()); } @@ -139,9 +139,9 @@ public function testShowPercentage() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowPercentage(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowPercentage(true)); $this->assertTrue($object->hasShowPercentage()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowPercentage(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowPercentage(false)); $this->assertFalse($object->hasShowPercentage()); } @@ -149,9 +149,9 @@ public function testShowSeriesName() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowSeriesName(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowSeriesName(true)); $this->assertTrue($object->hasShowSeriesName()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowSeriesName(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowSeriesName(false)); $this->assertFalse($object->hasShowSeriesName()); } @@ -159,9 +159,9 @@ public function testShowValue() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowValue(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowValue(true)); $this->assertTrue($object->hasShowValue()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setShowValue(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowValue(false)); $this->assertFalse($object->hasShowValue()); } @@ -169,9 +169,9 @@ public function testTitle() { $object = new Series(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setTitle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setTitle()); $this->assertEquals('Series Title', $object->getTitle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setTitle('AAAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setTitle('AAAA')); $this->assertEquals('AAAA', $object->getTitle()); } @@ -188,11 +188,11 @@ public function testValue() $this->assertInternalType('array', $object->getValues()); $this->assertEmpty($object->getValues()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setValues()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setValues()); $this->assertEmpty($object->getValues()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setValues($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setValues($array)); $this->assertCount(count($array), $object->getValues()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->addValue(4, 'e')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->addValue(4, 'e')); $this->assertCount(count($array) + 1, $object->getValues()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php b/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php new file mode 100644 index 000000000..a2ba66f9e --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php @@ -0,0 +1,134 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + $this->assertEquals('Calibri', $object->getFont()->getName()); + $this->assertEquals(18, $object->getFont()->getSize()); + } + + public function testAlignment() + { + $object = new Title(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setAlignment(new Alignment())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + } + + public function testFont() + { + $object = new Title(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont()); + $this->assertNull($object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont(new Font())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + } + + public function testHashIndex() + { + $object = new Title(); + $value = rand(1, 100); + + $this->assertEmpty($object->getHashIndex()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHashIndex($value)); + $this->assertEquals($value, $object->getHashIndex()); + } + + public function testHeight() + { + $object = new Title(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight()); + $this->assertEquals(0, $object->getHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight($value)); + $this->assertEquals($value, $object->getHeight()); + } + + public function testOffsetX() + { + $object = new Title(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX()); + $this->assertEquals(0.01, $object->getOffsetX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX($value)); + $this->assertEquals($value, $object->getOffsetX()); + } + + public function testOffsetY() + { + $object = new Title(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY()); + $this->assertEquals(0.01, $object->getOffsetY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY($value)); + $this->assertEquals($value, $object->getOffsetY()); + } + + public function testText() + { + $object = new Title(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText()); + $this->assertNull($object->getText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText('AAAA')); + $this->assertEquals('AAAA', $object->getText()); + } + + public function testVisible() + { + $object = new Title(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible()); + $this->assertTrue($object->isVisible()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(true)); + $this->assertTrue($object->isVisible()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(false)); + $this->assertFalse($object->isVisible()); + } + + public function testWidth() + { + $object = new Title(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth()); + $this->assertEquals(0, $object->getWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth($value)); + $this->assertEquals($value, $object->getWidth()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AbstractTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php similarity index 55% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/AbstractTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php index 636ee96ce..cc4644d40 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AbstractTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php @@ -1,28 +1,28 @@ assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Scatter', $object->setHashIndex($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->setHashIndex($value)); $this->assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php similarity index 56% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php index db338b273..c1766c141 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSeries() { $object = new Area(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php similarity index 54% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php index 6b51f5f74..021d3dc78 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSeries() { $object = new Bar3D(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } @@ -57,9 +57,9 @@ 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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_VERTICAL)); $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); } @@ -67,11 +67,11 @@ 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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_PERCENTSTACKED)); $this->assertEquals(Bar3D::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php similarity index 54% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php index 6126942e1..eba91bbc9 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSeries() { $object = new Bar(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } @@ -57,9 +57,9 @@ 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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_VERTICAL)); $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); } @@ -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\\PhpPresentation\\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\\PhpPresentation\\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\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_PERCENTSTACKED)); $this->assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/LineTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php similarity index 56% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/LineTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php index ca4e08196..96471cb76 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/LineTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Line', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Line', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Line', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Line', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSerties() { $object = new Line(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Line', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Line', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php similarity index 57% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php index 2b5895e24..da3c96ac5 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie3D', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie3D', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSeries() { $object = new Pie3D(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie3D', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } @@ -60,7 +60,7 @@ public function testExplosion() $object = new Pie3D(); $this->assertEquals(0, $object->getExplosion()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie3D', $object->setExplosion($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setExplosion($value)); $this->assertEquals($value, $object->getExplosion()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php similarity index 56% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php index 57625978b..d4a7b4661 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSeries() { $object = new Pie(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/ScatterTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php similarity index 56% rename from tests/PhpPowerpoint/Tests/Shape/Chart/Type/ScatterTest.php rename to tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php index d84b97a85..264658e0d 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/ScatterTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Scatter', $object->setData()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->setData()); $this->assertEmpty($object->getData()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Scatter', $object->setData($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->setData($array)); $this->assertCount(count($array), $object->getData()); } @@ -49,7 +49,7 @@ public function testSerties() { $object = new Scatter(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Scatter', $object->addSeries(new Series())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php new file mode 100644 index 000000000..720376be8 --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php @@ -0,0 +1,105 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent()); + $this->assertEquals(100, $object->getDepthPercent()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent($value)); + $this->assertEquals($value, $object->getDepthPercent()); + } + + public function testHashIndex() + { + $object = new View3D(); + $value = rand(1, 100); + + $this->assertEmpty($object->getHashIndex()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHashIndex($value)); + $this->assertEquals($value, $object->getHashIndex()); + } + + public function testHeightPercent() + { + $object = new View3D(); + $value = rand(5, 500); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent()); + $this->assertEquals(100, $object->getHeightPercent()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent($value)); + $this->assertEquals($value, $object->getHeightPercent()); + } + + public function testPerspective() + { + $object = new View3D(); + $value = rand(0, 100); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective()); + $this->assertEquals(30, $object->getPerspective()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective($value)); + $this->assertEquals($value, $object->getPerspective()); + } + + public function testRightAngleAxes() + { + $object = new View3D(); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes()); + $this->assertTrue($object->hasRightAngleAxes()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(true)); + $this->assertTrue($object->hasRightAngleAxes()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(false)); + $this->assertFalse($object->hasRightAngleAxes()); + } + + public function testRotationX() + { + $object = new View3D(); + $value = rand(-90, 90); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX()); + $this->assertEquals(0, $object->getRotationX()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX($value)); + $this->assertEquals($value, $object->getRotationX()); + } + + public function testRotationY() + { + $object = new View3D(); + $value = rand(-90, 90); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY()); + $this->assertEquals(0, $object->getRotationY()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY($value)); + $this->assertEquals($value, $object->getRotationY()); + } +} diff --git a/tests/PhpPresentation/Tests/Shape/ChartTest.php b/tests/PhpPresentation/Tests/Shape/ChartTest.php new file mode 100644 index 000000000..4ff2ff232 --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/ChartTest.php @@ -0,0 +1,65 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->getTitle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->getLegend()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->getPlotArea()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->getView3D()); + } + + + public function testClone() + { + $object = new Chart(); + + $oClone = clone $object; + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $oClone); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $oClone->getTitle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $oClone->getLegend()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $oClone->getPlotArea()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $oClone->getView3D()); + } + + public function testIncludeSpreadsheet() + { + $object = new Chart(); + + $this->assertFalse($object->hasIncludedSpreadsheet()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet()); + $this->assertFalse($object->hasIncludedSpreadsheet()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet(false)); + $this->assertFalse($object->hasIncludedSpreadsheet()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet(true)); + $this->assertTrue($object->hasIncludedSpreadsheet()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Shape/DrawingTest.php b/tests/PhpPresentation/Tests/Shape/DrawingTest.php similarity index 61% rename from tests/PhpPowerpoint/Tests/Shape/DrawingTest.php rename to tests/PhpPresentation/Tests/Shape/DrawingTest.php index 059519d1b..118fd699f 100644 --- a/tests/PhpPowerpoint/Tests/Shape/DrawingTest.php +++ b/tests/PhpPresentation/Tests/Shape/DrawingTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setPath()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setPath()); } public function testPathWithoutVerifyFile() { $object = new Drawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setPath('', false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setPath('', false)); $this->assertEmpty($object->getPath()); } @@ -56,9 +56,9 @@ public function testPathWithRealFile() { $object = new Drawing(); - $imagePath = PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png'; + $imagePath = PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PhpPresentationLogo.png'; - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setPath($imagePath, false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setPath($imagePath, false)); $this->assertEquals($imagePath, $object->getPath()); $this->assertEquals(0, $object->getWidth()); $this->assertEquals(0, $object->getHeight()); @@ -68,10 +68,10 @@ public function testGetSetDescription() { $object = new Drawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setDescription()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setDescription()); $this->assertEmpty($object->getDescription()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setDescription('TEST')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setDescription('TEST')); $this->assertEquals('TEST', $object->getDescription()); } @@ -79,12 +79,12 @@ public function testGetSetResizeProportional() { $object = new Drawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setResizeProportional()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setResizeProportional()); $this->assertTrue($object->isResizeProportional()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setResizeProportional(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setResizeProportional(false)); $this->assertFalse($object->isResizeProportional()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setResizeProportional(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setResizeProportional(true)); $this->assertTrue($object->isResizeProportional()); } @@ -92,9 +92,9 @@ public function testGetSetHeightWidth() { $object = new Drawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidth()); $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setHeight()); $this->assertEquals(0, $object->getHeight()); } /** @@ -106,9 +106,9 @@ public function testGetSetHeightWidthResizeProportionalFalse() $object = new Drawing(); $value = rand(0, 100); $object->setResizeProportional(false); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setWidth($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidth($value)); $this->assertEquals($value, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setHeight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setHeight($value)); $this->assertEquals($value, $object->getHeight()); } @@ -124,10 +124,10 @@ public function testGetSetHeightWidthResizeProportionalTrue() $object->setWidth($valueWidth); $object->setHeight($valueHeight); $object->setResizeProportional(true); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setWidth($valueWidth)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidth($valueWidth)); $this->assertEquals($valueWidth, $object->getWidth()); $this->assertEquals(round($valueWidth * ($valueHeight / $valueWidth)), $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setHeight($valueHeight)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setHeight($valueHeight)); $this->assertEquals($valueHeight, $object->getHeight()); $this->assertEquals(round($valueHeight * ($valueWidth / $valueHeight)), $object->getWidth()); } @@ -141,7 +141,7 @@ public function testSetWidthAndHeight() $object->setWidth($valueWidth); $object->setHeight($valueHeight); $object->setResizeProportional(true); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setWidthAndHeight($valueHeight, $valueWidth)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidthAndHeight($valueHeight, $valueWidth)); $this->assertEquals($valueHeight, $object->getWidth()); $this->assertEquals(ceil($valueHeight * ($valueHeight/$valueWidth)), $object->getHeight()); @@ -152,7 +152,7 @@ public function testSetWidthAndHeight() $object->setWidth($valueWidth); $object->setHeight($valueHeight); $object->setResizeProportional(true); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->setWidthAndHeight($valueWidth, $valueHeight)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidthAndHeight($valueWidth, $valueHeight)); $this->assertEquals($valueHeight, $object->getHeight()); $this->assertEquals(ceil($valueWidth * ($valueHeight/$valueHeight)), $object->getWidth()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPresentation/Tests/Shape/GroupTest.php similarity index 69% rename from tests/PhpPowerpoint/Tests/Shape/GroupTest.php rename to tests/PhpPresentation/Tests/Shape/GroupTest.php index 9f019cdfb..77ab387a0 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPresentation/Tests/Shape/GroupTest.php @@ -1,29 +1,29 @@ 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))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setWidth(rand(1, 100))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setHeight(rand(1, 100))); } 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->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->createChartShape()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->createDrawingShape()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Line', $object->createLineShape(10, 10, 10, 10)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table', $object->createTableShape()); $this->assertEquals(5, $object->getShapeCollection()->count()); } @@ -78,7 +78,7 @@ public function testOffsetX() $this->assertEquals(10, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetX(rand(1, 100))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetX(rand(1, 100))); $this->assertEquals(10, $object->getOffsetX()); } @@ -90,14 +90,14 @@ public function testOffsetY() $this->assertEquals(20, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetY(rand(1, 100))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetY(rand(1, 100))); $this->assertEquals(20, $object->getOffsetY()); } public function testExtentsAndOffsetsForOneShape() { // We record initial values here because - // PhpOffice\PhpPowerpoint\Shape\Line subtracts the offsets + // PhpOffice\PhpPresentation\Shape\Line subtracts the offsets // from the extents to produce a raw width and height. $offsetX = 100; $offsetY = 100; diff --git a/tests/PhpPowerpoint/Tests/Shape/HyperlinkTest.php b/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php similarity index 66% rename from tests/PhpPowerpoint/Tests/Shape/HyperlinkTest.php rename to tests/PhpPresentation/Tests/Shape/HyperlinkTest.php index 1843f68f6..85e241807 100644 --- a/tests/PhpPowerpoint/Tests/Shape/HyperlinkTest.php +++ b/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setSlideNumber()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); $this->assertEquals(1, $object->getSlideNumber()); $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setSlideNumber($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber($value)); $this->assertEquals($value, $object->getSlideNumber()); $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); } @@ -89,10 +89,10 @@ public function testGetSetTooltip() { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setTooltip()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip()); $this->assertEmpty($object->getTooltip()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setTooltip('TEST')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip('TEST')); $this->assertEquals('TEST', $object->getTooltip()); } @@ -100,10 +100,10 @@ public function testGetSetUrl() { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setUrl()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl()); $this->assertEmpty($object->getUrl()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); $this->assertEquals('http://www.github.com', $object->getUrl()); } @@ -111,10 +111,10 @@ public function testIsInternal() { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setSlideNumber()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); $this->assertTrue($object->isInternal()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); $this->assertFalse($object->isInternal()); } } diff --git a/tests/PhpPowerpoint/Tests/Shape/LineTest.php b/tests/PhpPresentation/Tests/Shape/LineTest.php similarity index 64% rename from tests/PhpPowerpoint/Tests/Shape/LineTest.php rename to tests/PhpPresentation/Tests/Shape/LineTest.php index ab08158d2..cac59a992 100644 --- a/tests/PhpPowerpoint/Tests/Shape/LineTest.php +++ b/tests/PhpPresentation/Tests/Shape/LineTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setImageResource()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setImageResource()); $this->assertNull($object->getImageResource()); $this->assertEquals(0, $object->getWidth()); $this->assertEquals(0, $object->getHeight()); @@ -53,7 +53,7 @@ public function testImageResource() $width = rand(1, 100); $height = rand(100, 200); $gdImage = @imagecreatetruecolor($width, $height); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setImageResource($gdImage)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setImageResource($gdImage)); $this->assertTrue(is_resource($object->getImageResource())); $this->assertEquals($width, $object->getWidth()); $this->assertEquals($height, $object->getHeight()); @@ -63,10 +63,10 @@ public function testMimeType() { $object = new MemoryDrawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setMimeType()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setMimeType()); $this->assertEquals(MemoryDrawing::MIMETYPE_DEFAULT, $object->getMimeType()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setMimeType(MemoryDrawing::MIMETYPE_JPEG)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setMimeType(MemoryDrawing::MIMETYPE_JPEG)); $this->assertEquals(MemoryDrawing::MIMETYPE_JPEG, $object->getMimeType()); } @@ -74,10 +74,10 @@ public function testRenderingFunction() { $object = new MemoryDrawing(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setRenderingFunction()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setRenderingFunction()); $this->assertEquals(MemoryDrawing::RENDERING_DEFAULT, $object->getRenderingFunction()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\MemoryDrawing', $object->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\MemoryDrawing', $object->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)); $this->assertEquals(MemoryDrawing::RENDERING_JPEG, $object->getRenderingFunction()); } } diff --git a/tests/PhpPowerpoint/Tests/Shape/RichText/BreakElementTest.php b/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php similarity index 58% rename from tests/PhpPowerpoint/Tests/Shape/RichText/BreakElementTest.php rename to tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php index 973b8f105..6fb7f598b 100644 --- a/tests/PhpPowerpoint/Tests/Shape/RichText/BreakElementTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php @@ -1,28 +1,28 @@ assertEquals("\r\n", $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->setText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText()); $this->assertEquals("\r\n", $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->setText('AAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText('AAA')); $this->assertEquals("\r\n", $object->getText()); } diff --git a/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php b/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php new file mode 100644 index 000000000..94901999d --- /dev/null +++ b/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php @@ -0,0 +1,151 @@ +assertEmpty($object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->getBulletStyle()); + } + + public function testAlignment() + { + $object = new Paragraph(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setAlignment(new Alignment())); + } + + /** + * Test get/set bullet style + */ + public function testBulletStyle() + { + $object = new Paragraph(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->getBulletStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setBulletStyle()); + $this->assertNull($object->getBulletStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setBulletStyle(new Bullet())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->getBulletStyle()); + } + + /** + * Test get/set font + */ + public function testFont() + { + $object = new Paragraph(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setFont()); + $this->assertNull($object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setFont(new Font())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + } + + /** + * Test get/set hashCode + */ + public function testHashCode() + { + $object = new Paragraph(); + $oElement = new TextElement(); + $object->addText($oElement); + $this->assertEquals(md5($oElement->getHashCode().$object->getFont()->getHashCode().get_class($object)), $object->getHashCode()); + } + + /** + * Test get/set hashIndex + */ + public function testHashIndex() + { + $object = new Paragraph(); + $value = rand(1, 100); + $object->setHashIndex($value); + $this->assertEquals($value, $object->getHashIndex()); + } + + /** + * Test get/set richTextElements + */ + public function testRichTextElements() + { + $object = new Paragraph(); + $this->assertInternalType('array', $object->getRichTextElements()); + $this->assertEmpty($object->getRichTextElements()); + $object->createBreak(); + $this->assertCount(1, $object->getRichTextElements()); + + $array = array( + new TextElement(), + new TextElement(), + new TextElement(), + ); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setRichTextElements($array)); + $this->assertCount(3, $object->getRichTextElements()); + } + + /** + * @expectedException \Exception + * expectedExceptionMessage Invalid \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface[] array passed. + */ + public function testRichTextElementsException() + { + $object = new Paragraph(); + $object->setRichTextElements(1); + } + + /** + * Test text methods + */ + public function testText() + { + $object = new Paragraph(); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->addText(new TextElement())); + $this->assertcount(1, $object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText()); + $this->assertcount(2, $object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('AAA')); + $this->assertcount(3, $object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); + $this->assertcount(4, $object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); + $this->assertcount(5, $object->getRichTextElements()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BBB')); + $this->assertcount(6, $object->getRichTextElements()); + $this->assertEquals('AAA'."\r\n".'BBB', $object->getPlainText()); + $this->assertEquals('AAA'."\r\n".'BBB', (string) $object); + } +} diff --git a/tests/PhpPowerpoint/Tests/Shape/RichText/RunTest.php b/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php similarity index 52% rename from tests/PhpPowerpoint/Tests/Shape/RichText/RunTest.php rename to tests/PhpPresentation/Tests/Shape/RichText/RunTest.php index a462c1440..2739d9929 100644 --- a/tests/PhpPowerpoint/Tests/Shape/RichText/RunTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php @@ -1,29 +1,29 @@ assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); $object = new Run('BBB'); $this->assertEquals('BBB', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testFont() { $object = new Run(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->getFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setFont(new Font())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testText() { $object = new Run(); $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->setText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText()); $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->setText('AAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText('AAA')); $this->assertEquals('AAA', $object->getText()); $object = new Run('BBB'); diff --git a/tests/PhpPowerpoint/Tests/Shape/RichText/TextElementTest.php b/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php similarity index 55% rename from tests/PhpPowerpoint/Tests/Shape/RichText/TextElementTest.php rename to tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php index 50cf84529..0ceafb787 100644 --- a/tests/PhpPowerpoint/Tests/Shape/RichText/TextElementTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php @@ -1,29 +1,29 @@ assertFalse($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->setHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink()); $this->assertFalse($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->getHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Hyperlink', $object->getHyperlink()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); } public function testText() { $object = new TextElement(); $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->setText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText()); $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->setText('AAA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText('AAA')); $this->assertEquals('AAA', $object->getText()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/RichTextTest.php b/tests/PhpPresentation/Tests/Shape/RichTextTest.php similarity index 53% rename from tests/PhpPowerpoint/Tests/Shape/RichTextTest.php rename to tests/PhpPresentation/Tests/Shape/RichTextTest.php index 1c3f4131a..07cac16fc 100644 --- a/tests/PhpPowerpoint/Tests/Shape/RichTextTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichTextTest.php @@ -1,30 +1,30 @@ assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->createParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); $this->assertCount(2, $object->getParagraphs()); $value = rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); $this->assertEquals($value, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph()); $value = rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); } /** @@ -75,7 +75,7 @@ public function testColumns() $object = new RichText(); $value = rand(1, 16); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setColumns($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setColumns($value)); $this->assertEquals($value, $object->getColumns()); } @@ -99,14 +99,14 @@ public function testParagraphs() new Paragraph(), ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setParagraphs($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setParagraphs($array)); $this->assertCount(3, $object->getParagraphs()); $this->assertEquals(2, $object->getActiveParagraphIndex()); } /** * @expectedException \Exception - * expectedExceptionMessage Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] array passed. + * expectedExceptionMessage Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed. */ public function testParagraphsException() { @@ -117,19 +117,19 @@ public function testParagraphsException() public function testText() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addText()); $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addText(new TextElement())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addText(new TextElement())); $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText()); $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->createBreak()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun('BETA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BETA')); $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements()); $this->assertEquals('ALPHA'."\r\n".'BETA', $object->getPlainText()); $this->assertEquals('ALPHA'."\r\n".'BETA', (string) $object); @@ -139,10 +139,10 @@ public function testGetSetAutoFit() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoFit()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoFit()); $this->assertEquals(RichText::AUTOFIT_DEFAULT, $object->getAutoFit()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoFit(RichText::AUTOFIT_NORMAL)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoFit(RichText::AUTOFIT_NORMAL)); $this->assertEquals(RichText::AUTOFIT_NORMAL, $object->getAutoFit()); } @@ -150,32 +150,32 @@ public function testGetSetHAutoShrink() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkHorizontal()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkHorizontal()); $this->assertNull($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkHorizontal(2)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkHorizontal(2)); $this->assertNull($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkHorizontal(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkHorizontal(true)); $this->assertTrue($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkHorizontal(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkHorizontal(false)); $this->assertFalse($object->hasAutoShrinkHorizontal()); } public function testGetSetVAutoShrink() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkVertical()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkVertical()); $this->assertNull($object->hasAutoShrinkVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkVertical(2)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkVertical(2)); $this->assertNull($object->hasAutoShrinkVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkVertical(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkVertical(true)); $this->assertTrue($object->hasAutoShrinkVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setAutoShrinkVertical(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setAutoShrinkVertical(false)); $this->assertFalse($object->hasAutoShrinkVertical()); } @@ -183,10 +183,10 @@ public function testGetSetHOverflow() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setHorizontalOverflow()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setHorizontalOverflow()); $this->assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getHorizontalOverflow()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setHorizontalOverflow(RichText::OVERFLOW_CLIP)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setHorizontalOverflow(RichText::OVERFLOW_CLIP)); $this->assertEquals(RichText::OVERFLOW_CLIP, $object->getHorizontalOverflow()); } @@ -195,24 +195,24 @@ public function testGetSetInset() $object = new RichText(); // Default - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetBottom()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetBottom()); $this->assertEquals(4.8, $object->getInsetBottom()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetLeft()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetLeft()); $this->assertEquals(9.6, $object->getInsetLeft()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetRight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetRight()); $this->assertEquals(9.6, $object->getInsetRight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetTop()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetTop()); $this->assertEquals(4.8, $object->getInsetTop()); // Value $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetBottom($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetBottom($value)); $this->assertEquals($value, $object->getInsetBottom()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetLeft($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetLeft($value)); $this->assertEquals($value, $object->getInsetLeft()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetRight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetRight($value)); $this->assertEquals($value, $object->getInsetRight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setInsetTop($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setInsetTop($value)); $this->assertEquals($value, $object->getInsetTop()); } @@ -220,13 +220,13 @@ public function testGetSetUpright() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setUpright()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setUpright()); $this->assertFalse($object->isUpright()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setUpright(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setUpright(true)); $this->assertTrue($object->isUpright()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setUpright(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setUpright(false)); $this->assertFalse($object->isUpright()); } @@ -234,13 +234,13 @@ public function testGetSetVertical() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setVertical()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setVertical()); $this->assertFalse($object->isVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setVertical(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setVertical(true)); $this->assertTrue($object->isVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setVertical(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setVertical(false)); $this->assertFalse($object->isVertical()); } @@ -248,10 +248,10 @@ public function testGetSetVOverflow() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setVerticalOverflow()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setVerticalOverflow()); $this->assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getVerticalOverflow()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setVerticalOverflow(RichText::OVERFLOW_CLIP)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setVerticalOverflow(RichText::OVERFLOW_CLIP)); $this->assertEquals(RichText::OVERFLOW_CLIP, $object->getVerticalOverflow()); } @@ -259,10 +259,10 @@ public function testGetSetWrap() { $object = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setWrap()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setWrap()); $this->assertEquals(RichText::WRAP_SQUARE, $object->getWrap()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->setWrap(RichText::WRAP_NONE)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->setWrap(RichText::WRAP_NONE)); $this->assertEquals(RichText::WRAP_NONE, $object->getWrap()); } diff --git a/tests/PhpPowerpoint/Tests/Shape/Table/CellTest.php b/tests/PhpPresentation/Tests/Shape/Table/CellTest.php similarity index 52% rename from tests/PhpPowerpoint/Tests/Shape/Table/CellTest.php rename to tests/PhpPresentation/Tests/Shape/Table/CellTest.php index c78a7d764..7bb993459 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Table/CellTest.php +++ b/tests/PhpPresentation/Tests/Shape/Table/CellTest.php @@ -1,32 +1,32 @@ assertEquals(0, $object->getActiveParagraphIndex()); $this->assertCount(1, $object->getParagraphs()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Borders', $object->getBorders()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); } public function testActiveParagraph() { $object = new Cell(); $this->assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->createParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); $this->assertCount(2, $object->getParagraphs()); $value = rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); $this->assertEquals($value, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph()); $value = rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); } /** @@ -91,19 +91,19 @@ public function testSetGetHashIndex() public function testText() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->addText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText()); $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->addText(new TextElement())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText(new TextElement())); $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText()); $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->createBreak()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun('BETA')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BETA')); $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements()); $this->assertEquals('ALPHA'."\r\n".'BETA', $object->getPlainText()); $this->assertEquals('ALPHA'."\r\n".'BETA', (string) $object); @@ -119,14 +119,14 @@ public function testParagraphs() new Paragraph(), ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setParagraphs($array)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setParagraphs($array)); $this->assertCount(3, $object->getParagraphs()); $this->assertEquals(2, $object->getActiveParagraphIndex()); } /** * @expectedException \Exception - * expectedExceptionMessage Invalid \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] array passed. + * expectedExceptionMessage Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed. */ public function testParagraphsException() { @@ -138,19 +138,19 @@ public function testGetSetBorders() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setBorders(new Borders())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Borders', $object->getBorders()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setBorders(new Borders())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); } public function testGetSetColspan() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setColSpan()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan()); $this->assertEquals(0, $object->getColSpan()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setColSpan($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan($value)); $this->assertEquals($value, $object->getColSpan()); } @@ -158,19 +158,19 @@ public function testGetSetFill() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setFill(new Fill())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setFill(new Fill())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testGetSetRowspan() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setRowSpan()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan()); $this->assertEquals(0, $object->getRowSpan()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setRowSpan($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan($value)); $this->assertEquals($value, $object->getRowSpan()); } @@ -178,11 +178,11 @@ public function testGetSetWidth() { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth()); $this->assertEquals(0, $object->getWidth()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->setWidth($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth($value)); $this->assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPowerpoint/Tests/Shape/Table/RowTest.php b/tests/PhpPresentation/Tests/Shape/Table/RowTest.php similarity index 59% rename from tests/PhpPowerpoint/Tests/Shape/Table/RowTest.php rename to tests/PhpPresentation/Tests/Shape/Table/RowTest.php index 7434cf109..8df703e23 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Table/RowTest.php +++ b/tests/PhpPresentation/Tests/Shape/Table/RowTest.php @@ -1,29 +1,29 @@ assertCount(1, $object->getCells()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); $value = rand(1, 100); $object = new Row($value); $this->assertCount($value, $object->getCells()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testGetCell() { $object = new Row(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->getCell(0)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->getCell(0)); $this->assertNull($object->getCell(1000, true)); } @@ -64,7 +64,7 @@ public function testNextCell() { $object = new Row(2); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Cell', $object->nextCell()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->nextCell()); } /** @@ -93,19 +93,19 @@ public function testGetSetFill() { $object = new Row(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Row', $object->setFill(new Fill())); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setFill(new Fill())); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testGetSetHeight() { $object = new Row(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Row', $object->setHeight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight()); $this->assertEquals(0, $object->getHeight()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Row', $object->setHeight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight($value)); $this->assertEquals($value, $object->getHeight()); } } diff --git a/tests/PhpPowerpoint/Tests/Shape/TableTest.php b/tests/PhpPresentation/Tests/Shape/TableTest.php similarity index 64% rename from tests/PhpPowerpoint/Tests/Shape/TableTest.php rename to tests/PhpPresentation/Tests/Shape/TableTest.php index 56ee5e5a3..0deea7dfd 100644 --- a/tests/PhpPowerpoint/Tests/Shape/TableTest.php +++ b/tests/PhpPresentation/Tests/Shape/TableTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Row', $object->createRow()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->createRow()); $this->assertCount(1, $object->getRows()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table\\Row', $object->getRow(0)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->getRow(0)); $this->assertNull($object->getRow(1, true)); } diff --git a/tests/PhpPresentation/Tests/Slide/IteratorTest.php b/tests/PhpPresentation/Tests/Slide/IteratorTest.php new file mode 100644 index 000000000..053ea829a --- /dev/null +++ b/tests/PhpPresentation/Tests/Slide/IteratorTest.php @@ -0,0 +1,51 @@ +addSlide(new Slide()); + + $object = new Iterator($oPhpPresentation); + + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); + $this->assertEquals(0, $object->key()); + $this->assertNull($object->next()); + $this->assertEquals(1, $object->key()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); + $this->assertTrue($object->valid()); + $this->assertNull($object->next()); + $this->assertFalse($object->valid()); + $this->assertNull($object->rewind()); + $this->assertEquals(0, $object->key()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Slide/NoteTest.php b/tests/PhpPresentation/Tests/Slide/NoteTest.php similarity index 63% rename from tests/PhpPowerpoint/Tests/Slide/NoteTest.php rename to tests/PhpPresentation/Tests/Slide/NoteTest.php index ede2bed16..b57499fa2 100644 --- a/tests/PhpPowerpoint/Tests/Slide/NoteTest.php +++ b/tests/PhpPresentation/Tests/Slide/NoteTest.php @@ -1,30 +1,30 @@ assertNull($object->getParent()); - $oPhpPowerpoint = new PhpPowerpoint(); - $oSlide = $oPhpPowerpoint->createSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->createSlide(); $oSlide->setNote($object); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getParent()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getParent()); } public function testExtent() @@ -67,11 +67,11 @@ public function testShape() { $object = new Note(); $this->assertEquals(0, $object->getShapeCollection()->count()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->createRichTextShape()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); $this->assertEquals(1, $object->getShapeCollection()->count()); $oRichText = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addShape($oRichText)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addShape($oRichText)); $this->assertEquals(2, $object->getShapeCollection()->count()); } diff --git a/tests/PhpPowerpoint/Tests/Slide/TransitionTest.php b/tests/PhpPresentation/Tests/Slide/TransitionTest.php similarity index 50% rename from tests/PhpPowerpoint/Tests/Slide/TransitionTest.php rename to tests/PhpPresentation/Tests/Slide/TransitionTest.php index 531aadc4a..4b1b56dad 100644 --- a/tests/PhpPowerpoint/Tests/Slide/TransitionTest.php +++ b/tests/PhpPresentation/Tests/Slide/TransitionTest.php @@ -1,28 +1,28 @@ assertNull($object->getSpeed()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setSpeed()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed()); $this->assertEquals(Transition::SPEED_MEDIUM, $object->getSpeed()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setSpeed(Transition::SPEED_FAST)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed(rand(1, 1000))); $this->assertNull($object->getSpeed()); } @@ -42,15 +42,15 @@ public function testManualTrigger() { $object = new Transition(); $this->assertFalse($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger()); $this->assertFalse($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(true)); $this->assertTrue($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(null)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(null)); $this->assertTrue($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(false)); $this->assertFalse($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(null)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(null)); $this->assertFalse($object->hasManualTrigger()); } @@ -59,23 +59,23 @@ public function testTimeTrigger() $object = new Transition(); $this->assertFalse($object->hasTimeTrigger()); $this->assertNull($object->getAdvanceTimeTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger(null, $value)); $this->assertFalse($object->hasTimeTrigger()); $this->assertNull($object->getAdvanceTimeTrigger()); } @@ -84,9 +84,9 @@ public function testTransitionType() { $object = new Transition(); $this->assertNull($object->getTransitionType()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType()); $this->assertNull($object->getTransitionType()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM)); $this->assertEquals(Transition::TRANSITION_RANDOM, $object->getTransitionType()); } diff --git a/tests/PhpPowerpoint/Tests/SlideTest.php b/tests/PhpPresentation/Tests/SlideTest.php similarity index 53% rename from tests/PhpPowerpoint/Tests/SlideTest.php rename to tests/PhpPresentation/Tests/SlideTest.php index 6dd0783bd..6b161ed25 100644 --- a/tests/PhpPowerpoint/Tests/SlideTest.php +++ b/tests/PhpPresentation/Tests/SlideTest.php @@ -1,30 +1,30 @@ assertNull($object->getParent()); - $oPhpPowerpoint = new PhpPowerpoint(); - $object = new Slide($oPhpPowerpoint); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $object->getParent()); + $oPhpPresentation = new PhpPresentation(); + $object = new Slide($oPhpPresentation); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getParent()); } public function testSlideLayout() { $object = new Slide(); $this->assertEquals(Slide\Layout::BLANK, $object->getSlideLayout()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setSlideLayout()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setSlideLayout()); $this->assertEquals(Slide\Layout::BLANK, $object->getSlideLayout()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setSlideLayout(Slide\Layout::TITLE_SLIDE)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setSlideLayout(Slide\Layout::TITLE_SLIDE)); $this->assertEquals(Slide\Layout::TITLE_SLIDE, $object->getSlideLayout()); } @@ -72,16 +72,16 @@ public function testSlideMasterId() $object = new Slide(); $this->assertEquals(1, $object->getSlideMasterId()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setSlideMasterId()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setSlideMasterId()); $this->assertEquals(1, $object->getSlideMasterId()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setSlideMasterId($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setSlideMasterId($value)); $this->assertEquals($value, $object->getSlideMasterId()); } public function testGroup() { $object = new Slide(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->createGroup()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->createGroup()); } public function testTransition() @@ -89,11 +89,11 @@ public function testTransition() $object = new Slide(); $oTransition = new Transition(); $this->assertNull($object->getTransition()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setTransition()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\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->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setTransition($oTransition)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->getTransition()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->setTransition(null)); $this->assertNull($object->getTransition()); } } diff --git a/tests/PhpPowerpoint/Tests/Style/AlignmentTest.php b/tests/PhpPresentation/Tests/Style/AlignmentTest.php similarity index 64% rename from tests/PhpPowerpoint/Tests/Style/AlignmentTest.php rename to tests/PhpPresentation/Tests/Style/AlignmentTest.php index 36d574208..2996a5ffa 100644 --- a/tests/PhpPowerpoint/Tests/Style/AlignmentTest.php +++ b/tests/PhpPresentation/Tests/Style/AlignmentTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setHorizontal('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setHorizontal('')); $this->assertEquals(Alignment::HORIZONTAL_LEFT, $object->getHorizontal()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setHorizontal(Alignment::HORIZONTAL_GENERAL)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setHorizontal(Alignment::HORIZONTAL_GENERAL)); $this->assertEquals(Alignment::HORIZONTAL_GENERAL, $object->getHorizontal()); } @@ -58,9 +58,9 @@ public function testSetGetHorizontal() public function testSetGetVertical() { $object = new Alignment(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setVertical('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setVertical('')); $this->assertEquals(Alignment::VERTICAL_BASE, $object->getVertical()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setVertical(Alignment::VERTICAL_AUTO)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setVertical(Alignment::VERTICAL_AUTO)); $this->assertEquals(Alignment::VERTICAL_AUTO, $object->getVertical()); } @@ -91,7 +91,7 @@ public function testSetGetLevel() { $object = new Alignment(); $value = rand(1, 8); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setLevel($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setLevel($value)); $this->assertEquals($value, $object->getLevel()); } @@ -104,18 +104,18 @@ public function testSetGetIndent() // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setIndent($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setIndent($value)); $this->assertEquals(0, $object->getIndent()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setIndent($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setIndent($value)); $this->assertEquals($value, $object->getIndent()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setIndent($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setIndent($value)); $this->assertEquals($value, $object->getIndent()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setIndent($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setIndent($value)); $this->assertEquals($value, $object->getIndent()); } @@ -128,18 +128,18 @@ public function testSetGetMarginLeft() // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginLeft($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginLeft($value)); $this->assertEquals(0, $object->getMarginLeft()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginLeft($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginLeft($value)); $this->assertEquals($value, $object->getMarginLeft()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginLeft($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginLeft($value)); $this->assertEquals($value, $object->getMarginLeft()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginLeft($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginLeft($value)); $this->assertEquals($value, $object->getMarginLeft()); } @@ -152,18 +152,18 @@ public function testSetGetMarginRight() // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginRight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value)); $this->assertEquals(0, $object->getMarginRight()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginRight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value)); $this->assertEquals($value, $object->getMarginRight()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginRight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value)); $this->assertEquals($value, $object->getMarginRight()); $value = rand(-100, 0); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Alignment', $object->setMarginRight($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->setMarginRight($value)); $this->assertEquals($value, $object->getMarginRight()); } diff --git a/tests/PhpPowerpoint/Tests/Style/BorderTest.php b/tests/PhpPresentation/Tests/Style/BorderTest.php similarity index 55% rename from tests/PhpPowerpoint/Tests/Style/BorderTest.php rename to tests/PhpPresentation/Tests/Style/BorderTest.php index 73ba0ad4f..fb851dcd8 100644 --- a/tests/PhpPowerpoint/Tests/Style/BorderTest.php +++ b/tests/PhpPresentation/Tests/Style/BorderTest.php @@ -1,29 +1,29 @@ assertEquals(1, $object->getLineWidth()); $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals('FF000000', $object->getColor()->getARGB()); } @@ -46,10 +46,10 @@ public function testConstruct() public function testSetGetColor() { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor()); $this->assertNull($object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor(new Color(COLOR::COLOR_BLUE))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals('FF0000FF', $object->getColor()->getARGB()); } @@ -59,11 +59,11 @@ public function testSetGetColor() public function testSetGetDashStyle() { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setDashStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle()); $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setDashStyle('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle('')); $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setDashStyle(BORDER::DASH_DASH)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle(BORDER::DASH_DASH)); $this->assertEquals(Border::DASH_DASH, $object->getDashStyle()); } @@ -84,11 +84,11 @@ public function testSetGetHashIndex() public function testSetGetLineStyle() { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle()); $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineStyle('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle('')); $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineStyle(BORDER::LINE_DOUBLE)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle(BORDER::LINE_DOUBLE)); $this->assertEquals(Border::LINE_DOUBLE, $object->getLineStyle()); } @@ -98,10 +98,10 @@ public function testSetGetLineStyle() public function testSetGetLineWidth() { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineWidth()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth()); $this->assertEquals(1, $object->getLineWidth()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineWidth($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth($value)); $this->assertEquals($value, $object->getLineWidth()); } } diff --git a/tests/PhpPowerpoint/Tests/Style/BordersTest.php b/tests/PhpPresentation/Tests/Style/BordersTest.php similarity index 57% rename from tests/PhpPowerpoint/Tests/Style/BordersTest.php rename to tests/PhpPresentation/Tests/Style/BordersTest.php index 36672e562..2b4152c1a 100644 --- a/tests/PhpPowerpoint/Tests/Style/BordersTest.php +++ b/tests/PhpPresentation/Tests/Style/BordersTest.php @@ -1,29 +1,29 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getBottom()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getLeft()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getRight()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getTop()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getDiagonalDown()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->getDiagonalUp()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBottom()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getLeft()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getRight()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getTop()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalDown()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalUp()); $this->assertEquals(Border::LINE_NONE, $object->getDiagonalDown()->getLineStyle()); $this->assertEquals(Border::LINE_NONE, $object->getDiagonalUp()->getLineStyle()); } diff --git a/tests/PhpPowerpoint/Tests/Style/BulletTest.php b/tests/PhpPresentation/Tests/Style/BulletTest.php similarity index 60% rename from tests/PhpPowerpoint/Tests/Style/BulletTest.php rename to tests/PhpPresentation/Tests/Style/BulletTest.php index 2dd20de68..5fb0ccb72 100644 --- a/tests/PhpPowerpoint/Tests/Style/BulletTest.php +++ b/tests/PhpPresentation/Tests/Style/BulletTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletChar()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar()); $this->assertEquals('-', $object->getBulletChar()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletChar('a')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar('a')); $this->assertEquals('a', $object->getBulletChar()); } @@ -57,11 +57,11 @@ public function testSetGetBulletChar() public function testSetGetBulletFont() { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletFont()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont()); $this->assertEquals('Calibri', $object->getBulletFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletFont('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('')); $this->assertEquals('Calibri', $object->getBulletFont()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletFont('Arial')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('Arial')); $this->assertEquals('Arial', $object->getBulletFont()); } @@ -71,10 +71,10 @@ public function testSetGetBulletFont() public function testSetGetBulletNumericStartAt() { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletNumericStartAt()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt()); $this->assertEquals(1, $object->getBulletNumericStartAt()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletNumericStartAt($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt($value)); $this->assertEquals($value, $object->getBulletNumericStartAt()); } @@ -84,9 +84,9 @@ public function testSetGetBulletNumericStartAt() public function testSetGetBulletNumericStyle() { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletNumericStyle()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle()); $this->assertEquals(Bullet::NUMERIC_DEFAULT, $object->getBulletNumericStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletNumericStyle(Bullet::NUMERIC_ALPHALCPARENBOTH)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle(Bullet::NUMERIC_ALPHALCPARENBOTH)); $this->assertEquals(Bullet::NUMERIC_ALPHALCPARENBOTH, $object->getBulletNumericStyle()); } @@ -96,9 +96,9 @@ public function testSetGetBulletNumericStyle() public function testSetGetBulletType() { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletType()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType()); $this->assertEquals(Bullet::TYPE_NONE, $object->getBulletType()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Bullet', $object->setBulletType(Bullet::TYPE_BULLET)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType(Bullet::TYPE_BULLET)); $this->assertEquals(Bullet::TYPE_BULLET, $object->getBulletType()); } diff --git a/tests/PhpPowerpoint/Tests/Style/ColorTest.php b/tests/PhpPresentation/Tests/Style/ColorTest.php similarity index 60% rename from tests/PhpPowerpoint/Tests/Style/ColorTest.php rename to tests/PhpPresentation/Tests/Style/ColorTest.php index 3025994d1..c38b35204 100644 --- a/tests/PhpPowerpoint/Tests/Style/ColorTest.php +++ b/tests/PhpPresentation/Tests/Style/ColorTest.php @@ -1,28 +1,28 @@ assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setARGB()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB()); $this->assertEquals(Color::COLOR_BLACK, $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setARGB('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('')); $this->assertEquals(Color::COLOR_BLACK, $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); $this->assertEquals(Color::COLOR_BLUE, $object->getARGB()); } @@ -57,16 +57,16 @@ public function testSetGetARGB() public function testSetGetRGB() { $object = new Color(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB()); $this->assertEquals('000000', $object->getRGB()); $this->assertEquals('FF000000', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('')); $this->assertEquals('000000', $object->getRGB()); $this->assertEquals('FF000000', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB('555')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('555')); $this->assertEquals('555', $object->getRGB()); $this->assertEquals('FF555', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB('6666')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('6666')); $this->assertEquals('FF6666', $object->getRGB()); $this->assertEquals('FF6666', $object->getARGB()); } diff --git a/tests/PhpPowerpoint/Tests/Style/FillTest.php b/tests/PhpPresentation/Tests/Style/FillTest.php similarity index 53% rename from tests/PhpPowerpoint/Tests/Style/FillTest.php rename to tests/PhpPresentation/Tests/Style/FillTest.php index 338720a0e..bf2976aec 100644 --- a/tests/PhpPowerpoint/Tests/Style/FillTest.php +++ b/tests/PhpPresentation/Tests/Style/FillTest.php @@ -1,29 +1,29 @@ assertEquals(Fill::FILL_NONE, $object->getFillType()); $this->assertEquals(0, $object->getRotation()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getStartColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getStartColor()); $this->assertEquals(Color::COLOR_WHITE, $object->getStartColor()->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getEndColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getEndColor()); $this->assertEquals(Color::COLOR_BLACK, $object->getEndColor()->getARGB()); } @@ -47,10 +47,10 @@ public function testConstruct() public function testSetGetEndColor() { $object = new Fill(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setEndColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setEndColor()); $this->assertNull($object->getEndColor()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setEndColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getEndColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setEndColor(new Color(COLOR::COLOR_BLUE))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getEndColor()); $this->assertEquals(COLOR::COLOR_BLUE, $object->getEndColor()->getARGB()); } @@ -60,9 +60,9 @@ public function testSetGetEndColor() public function testSetGetFillType() { $object = new Fill(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setFillType()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType()); $this->assertEquals(Fill::FILL_NONE, $object->getFillType()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setFillType(Fill::FILL_GRADIENT_LINEAR)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType(Fill::FILL_GRADIENT_LINEAR)); $this->assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType()); } @@ -72,10 +72,10 @@ public function testSetGetFillType() public function testSetGetRotation() { $object = new Fill(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setRotation()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setRotation()); $this->assertEquals(0, $object->getRotation()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setRotation($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setRotation($value)); $this->assertEquals($value, $object->getRotation()); } @@ -85,10 +85,10 @@ public function testSetGetRotation() public function testSetGetStartColor() { $object = new Fill(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setStartColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setStartColor()); $this->assertNull($object->getStartColor()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setStartColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getStartColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setStartColor(new Color(COLOR::COLOR_BLUE))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getStartColor()); $this->assertEquals(COLOR::COLOR_BLUE, $object->getStartColor()->getARGB()); } diff --git a/tests/PhpPowerpoint/Tests/Style/FontTest.php b/tests/PhpPresentation/Tests/Style/FontTest.php similarity index 53% rename from tests/PhpPowerpoint/Tests/Style/FontTest.php rename to tests/PhpPresentation/Tests/Style/FontTest.php index a5a5050b7..9da614fdc 100644 --- a/tests/PhpPowerpoint/Tests/Style/FontTest.php +++ b/tests/PhpPresentation/Tests/Style/FontTest.php @@ -1,29 +1,29 @@ assertFalse($object->isSubScript()); $this->assertFalse($object->isStrikethrough()); $this->assertEquals(Font::UNDERLINE_NONE, $object->getUnderline()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); } @@ -51,10 +51,10 @@ public function testConstruct() public function testSetGetColor() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setColor()); $this->assertNull($object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setColor(new Color(Color::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setColor(new Color(Color::COLOR_BLUE))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); } @@ -64,11 +64,11 @@ public function testSetGetColor() public function testSetGetName() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setName()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setName()); $this->assertEquals('Calibri', $object->getName()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setName('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setName('')); $this->assertEquals('Calibri', $object->getName()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setName('Arial')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setName('Arial')); $this->assertEquals('Arial', $object->getName()); } @@ -78,12 +78,12 @@ public function testSetGetName() public function testSetGetSize() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSize()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSize()); $this->assertEquals(10, $object->getSize()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSize('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSize('')); $this->assertEquals(10, $object->getSize()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSize($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSize($value)); $this->assertEquals($value, $object->getSize()); } @@ -93,11 +93,11 @@ public function testSetGetSize() public function testSetGetUnderline() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setUnderline()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setUnderline()); $this->assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setUnderline('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setUnderline('')); $this->assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setUnderline(FONT::UNDERLINE_DASH)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setUnderline(FONT::UNDERLINE_DASH)); $this->assertEquals(FONT::UNDERLINE_DASH, $object->getUnderline()); } @@ -107,13 +107,13 @@ public function testSetGetUnderline() public function testSetIsBold() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setBold()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setBold()); $this->assertFalse($object->isBold()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setBold('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setBold('')); $this->assertFalse($object->isBold()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setBold(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setBold(false)); $this->assertFalse($object->isBold()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setBold(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setBold(true)); $this->assertTrue($object->isBold()); } @@ -123,13 +123,13 @@ public function testSetIsBold() public function testSetIsItalic() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setItalic()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setItalic()); $this->assertFalse($object->isItalic()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setItalic('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setItalic('')); $this->assertFalse($object->isItalic()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setItalic(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setItalic(false)); $this->assertFalse($object->isItalic()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setItalic(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setItalic(true)); $this->assertTrue($object->isItalic()); } @@ -139,13 +139,13 @@ public function testSetIsItalic() public function testSetIsStriketrough() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setStriketrough()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setStrikethrough()); $this->assertFalse($object->isStrikethrough()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setStriketrough('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setStrikethrough('')); $this->assertFalse($object->isStrikethrough()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setStriketrough(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setStrikethrough(false)); $this->assertFalse($object->isStrikethrough()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setStriketrough(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setStrikethrough(true)); $this->assertTrue($object->isStrikethrough()); } @@ -155,16 +155,16 @@ public function testSetIsStriketrough() public function testSetIsSubScript() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSubScript()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSubScript()); $this->assertFalse($object->isSubScript()); $this->assertTrue($object->isSuperScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSubScript('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSubScript('')); $this->assertFalse($object->isSubScript()); $this->assertTrue($object->isSuperScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSubScript(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSubScript(false)); $this->assertFalse($object->isSubScript()); $this->assertTrue($object->isSuperScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSubScript(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSubScript(true)); $this->assertTrue($object->isSubScript()); $this->assertFalse($object->isSuperScript()); } @@ -175,16 +175,16 @@ public function testSetIsSubScript() public function testSetIsSuperScript() { $object = new Font(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSuperScript()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSuperScript()); $this->assertFalse($object->isSuperScript()); $this->assertTrue($object->isSubScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSuperScript('')); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSuperScript('')); $this->assertFalse($object->isSuperScript()); $this->assertTrue($object->isSubScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSuperScript(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSuperScript(false)); $this->assertFalse($object->isSuperScript()); $this->assertTrue($object->isSubScript()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Font', $object->setSuperScript(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setSuperScript(true)); $this->assertTrue($object->isSuperScript()); $this->assertFalse($object->isSubScript()); } diff --git a/tests/PhpPowerpoint/Tests/Style/ShadowTest.php b/tests/PhpPresentation/Tests/Style/ShadowTest.php similarity index 57% rename from tests/PhpPowerpoint/Tests/Style/ShadowTest.php rename to tests/PhpPresentation/Tests/Style/ShadowTest.php index cc0871af4..78bfae9b1 100644 --- a/tests/PhpPowerpoint/Tests/Style/ShadowTest.php +++ b/tests/PhpPresentation/Tests/Style/ShadowTest.php @@ -1,29 +1,29 @@ assertEquals(2, $object->getDistance()); $this->assertEquals(0, $object->getDirection()); $this->assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); $this->assertEquals(50, $object->getAlpha()); } @@ -49,9 +49,9 @@ public function testConstruct() public function testSetGetAlignment() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setAlignment()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlignment()); $this->assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setAlignment(Shadow::SHADOW_CENTER)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlignment(Shadow::SHADOW_CENTER)); $this->assertEquals(Shadow::SHADOW_CENTER, $object->getAlignment()); } @@ -61,10 +61,10 @@ public function testSetGetAlignment() public function testSetGetAlpha() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setAlpha()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlpha()); $this->assertEquals(0, $object->getAlpha()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setAlpha($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setAlpha($value)); $this->assertEquals($value, $object->getAlpha()); } @@ -74,10 +74,10 @@ public function testSetGetAlpha() public function testSetGetBlurRadius() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setBlurRadius()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setBlurRadius()); $this->assertEquals(6, $object->getBlurRadius()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setBlurRadius($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setBlurRadius($value)); $this->assertEquals($value, $object->getBlurRadius()); } @@ -87,10 +87,10 @@ public function testSetGetBlurRadius() public function testSetGetColor() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setColor()); $this->assertNull($object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setColor(new Color(Color::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->getColor()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setColor(new Color(Color::COLOR_BLUE))); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); $this->assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); } @@ -100,10 +100,10 @@ public function testSetGetColor() public function testSetGetDirection() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setDirection()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setDirection()); $this->assertEquals(0, $object->getDirection()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setDirection($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setDirection($value)); $this->assertEquals($value, $object->getDirection()); } @@ -113,10 +113,10 @@ public function testSetGetDirection() public function testSetGetDistance() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setDistance()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setDistance()); $this->assertEquals(2, $object->getDistance()); $value = rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setDistance($value)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setDistance($value)); $this->assertEquals($value, $object->getDistance()); } @@ -137,11 +137,11 @@ public function testSetGetHashIndex() public function testSetIsVisible() { $object = new Shadow(); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setVisible()); $this->assertFalse($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible(false)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setVisible(false)); $this->assertFalse($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible(true)); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Shadow', $object->setVisible(true)); $this->assertTrue($object->isVisible()); } } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/AbstractPartTest.php similarity index 64% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/AbstractPartTest.php index c0f9ca7d0..c0c353c3c 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/AbstractPartTest.php @@ -1,33 +1,33 @@ addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oArea); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ChartBarTest.php similarity index 75% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/ChartBarTest.php index 43cec308e..e4221b00b 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ChartBarTest.php @@ -1,34 +1,34 @@ addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oBar); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -84,12 +84,12 @@ public function testChartBarHorizontal() $oBar->setBarDirection(Bar::DIRECTION_HORIZONTAL); $oBar->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oBar); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ChartsTest.php similarity index 81% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/ChartsTest.php index 9fc5e55ff..6d6d881d7 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ChartsTest.php @@ -1,38 +1,38 @@ getMockForAbstractClass('PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType'); + $oStub = $this->getMockForAbstractClass('PhpOffice\PhpPresentation\Shape\Chart\Type\AbstractType'); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oStub); - TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); } public function testTitleVisibility() { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oLine = new Line(); $oShape->getPlotArea()->setType($oLine); @@ -73,13 +73,13 @@ public function testTitleVisibility() $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->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, '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->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $this->assertFalse($oXMLDoc->elementExists($elementTitle, 'Object 1/content.xml')); $this->assertFalse($oXMLDoc->elementExists($elementStyle, 'Object 1/content.xml')); } @@ -95,12 +95,12 @@ public function testChartBar3D() $oBar3D = new Bar3D(); $oBar3D->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oBar3D); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -130,12 +130,12 @@ public function testChartBar3DHorizontal() $oBar3D->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); $oBar3D->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oBar3D); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -158,12 +158,12 @@ public function testChartLine() $oLine = new Line(); $oLine->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oLine); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -197,12 +197,12 @@ public function testChartPie() $oPie = new Pie(); $oPie->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oPie); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -231,12 +231,12 @@ public function testChartPie3D() $oPie3D = new Pie3D(); $oPie3D->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oPie3D); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -265,12 +265,12 @@ public function testChartPie3DExplosion() $oPie3D->setExplosion($value); $oPie3D->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oPie3D); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -285,12 +285,12 @@ public function testChartScatter() $oScatter = new Scatter(); $oScatter->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oScatter); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); @@ -305,12 +305,12 @@ public function testLegend() $oLine = new Line(); $oLine->addSeries($oSeries); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oLine); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php similarity index 85% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php index 4af9d7aca..0fb9ffab5 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php @@ -1,40 +1,40 @@ getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oShape = $oSlide->createDrawingShape(); - $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); - $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); } public function testGroup() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->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/'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:g'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -80,8 +80,8 @@ public function testGroup() public function testList() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); $oRichText->createTextRun('Alpha'); @@ -89,7 +89,7 @@ public function testList() $oRichText->createParagraph()->createTextRun('Delta'); $oRichText->createParagraph()->createTextRun('Epsilon'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/text:list-style/text:list-level-style-bullet'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -103,8 +103,8 @@ public function testList() public function testInnerList() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT)->setMarginLeft(25)->setIndent(-25); @@ -123,7 +123,7 @@ public function testInnerList() $oRichText->createParagraph()->createTextRun('Beta.Beta'); $oRichText->createParagraph()->createTextRun('Beta.Delta'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/text:list-style/text:list-level-style-bullet'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -137,8 +137,8 @@ public function testInnerList() public function testParagraphRichText() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('Alpha'); $oRichText->createBreak(); @@ -147,7 +147,7 @@ public function testParagraphRichText() $oRun = $oRichText->createTextRun('Delta'); $oRun->getHyperlink()->setUrl('http://www.google.fr'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/draw:text-box/text:p/text:span/text:line-break'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -159,8 +159,8 @@ public function testParagraphRichText() public function testListWithRichText() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); $oRun = $oRichText->createTextRun('Alpha'); @@ -168,7 +168,7 @@ public function testListWithRichText() $oRichText->createBreak(); $oRichText->createTextRun('Beta'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/draw:text-box/text:list/text:list-item/text:p/text:span/text:a'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -178,13 +178,13 @@ public function testListWithRichText() public function testNote() { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oNote = $oSlide->getNote(); $oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600); $oRichText->createTextRun('testNote'); - $pres = TestHelperDOCX::getDocument($oPHPPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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'; @@ -193,18 +193,18 @@ public function testNote() public function testRichTextAutoShrink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText1 = $oSlide->createRichTextShape(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; $this->assertFalse($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml')); $this->assertFalse($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml')); $oRichText1->setAutoShrinkHorizontal(false); $oRichText1->setAutoShrinkVertical(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml')); $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml')); @@ -214,7 +214,7 @@ public function testRichTextAutoShrink() $oRichText1->setAutoShrinkHorizontal(true); $oRichText1->setAutoShrinkVertical(false); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml')); $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml')); @@ -224,14 +224,14 @@ public function testRichTextAutoShrink() public function testRichTextBorder() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->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'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -239,7 +239,7 @@ public function testRichTextBorder() $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'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -251,7 +251,7 @@ public function testRichTextBorder() $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'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -262,8 +262,8 @@ public function testRichTextBorder() public function testRichTextShadow() { $randAlpha = rand(0, 100); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('AAA'); $oRichText->getShadow()->setVisible(true)->setAlpha($randAlpha)->setBlurRadius(2); @@ -272,7 +272,7 @@ public function testRichTextShadow() for ($inc = 0; $inc <= 360; $inc += 45) { $randDistance = rand(0, 100); $oRichText->getShadow()->setDirection($inc)->setDistance($randDistance); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -308,8 +308,8 @@ public function testRichTextShadow() public function testStyleAlignment() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText1 = $oSlide->createRichTextShape(); $oRichText1->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); $oRichText1->createTextRun('Run1'); @@ -340,7 +340,7 @@ public function testStyleAlignment() $oRichText6->createTextRun('Run6'); $p6HashCode = $oRichText6->getActiveParagraph()->getHashCode(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'P_'.$p1HashCode.'\']/style:paragraph-properties'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -369,15 +369,15 @@ public function testStyleAlignment() public function testStyleFont() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRun = $oRichText->createTextRun('Run1'); $oRun->getFont()->setBold(true); $expectedHashCode = $oRun->getFont()->getHashCode(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'T_'.$expectedHashCode.'\']/style:text-properties'; $this->assertTrue($pres->elementExists($element, 'content.xml')); @@ -386,11 +386,11 @@ public function testStyleFont() public function testTable() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oSlide->createTableShape(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table'; $this->assertTrue($pres->elementExists($element, 'content.xml')); } @@ -403,14 +403,14 @@ public function testTableCellFill() $oFill = new Fill(); $oFill->setFillType(Fill::FILL_SOLID)->setStartColor($oColor); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(); $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->setFill($oFill); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -425,39 +425,39 @@ public function testTableWithColspan() { $value = rand(2, 100); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape($value); $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->setColSpan($value); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals($value, $pres->getElementAttribute($element, 'table:number-columns-spanned', 'content.xml')); } /** - * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/70 + * @link : https://github.com/PHPOffice/PHPPresentation/issues/70 */ public function testTableWithHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->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/'); + $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPresentation/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); + $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); } public function testTableWithText() @@ -465,15 +465,15 @@ public function testTableWithText() $oRun = new Run(); $oRun->setText('Test'); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(); $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->addText($oRun); $oCell->createBreak(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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); @@ -487,19 +487,19 @@ public function testTransition() $oTransition = new Transition(); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $phpPresentation = new PhpPresentation(); + $oSlide = $phpPresentation->getActiveSlide(); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePage0\']/style:drawing-page-properties'; - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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'); + $pres = TestHelperDOCX::getDocument($phpPresentation, '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')); @@ -508,18 +508,18 @@ public function testTransition() $this->assertContains('automatic', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml')); $oTransition->setSpeed(Transition::SPEED_FAST); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $this->assertContains('fast', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); $oTransition->setSpeed(Transition::SPEED_MEDIUM); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $this->assertContains('medium', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); $oTransition->setSpeed(Transition::SPEED_SLOW); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $this->assertContains('slow', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); - $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); + $rcTransition = new \ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { if (strpos($key, 'TRANSITION_') !== 0) { @@ -528,7 +528,7 @@ public function testTransition() $oTransition->setTransitionType($rcTransition->getConstant($key)); $oSlide->setTransition($oTransition); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertContains('horizontal-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); @@ -678,7 +678,7 @@ public function testTransition() } $oTransition->setManualTrigger(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); $this->assertContains('manual', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml')); } } diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/DrawingTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/DrawingTest.php new file mode 100644 index 000000000..004fa1b48 --- /dev/null +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/DrawingTest.php @@ -0,0 +1,55 @@ +getActiveSlide(); + $oGroup = $oSlide->createGroup(); + + $oDrawing = new Drawing(); + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation)); + $this->assertEmpty($oDrawing->allDrawings($oPhpPresentation)); + + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation)); + $this->assertCount(3, $oDrawing->allDrawings($oPhpPresentation)); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ManifestTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ManifestTest.php similarity index 55% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/ManifestTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/ManifestTest.php index 488ff89c3..5fbe01fa7 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ManifestTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ManifestTest.php @@ -1,31 +1,31 @@ getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createDrawingShape(); - $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $element = '/manifest:manifest/manifest:file-entry[5]'; $this->assertTrue($pres->elementExists($element, 'META-INF/manifest.xml')); $this->assertEquals('Pictures/'.md5($oShape->getPath()).'.'.$oShape->getExtension(), $pres->getElementAttribute($element, 'manifest:full-path', 'META-INF/manifest.xml')); @@ -52,17 +52,17 @@ public function testDrawing() public function testMemoryDrawing() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = new MemoryDrawing(); $gdImage = @imagecreatetruecolor(140, 20); $textColor = imagecolorallocate($gdImage, 255, 255, 255); - imagestring($gdImage, 1, 5, 5, 'Created with PHPPowerPoint', $textColor); + imagestring($gdImage, 1, 5, 5, 'Created with PhpPresentation', $textColor); $oShape->setImageResource($gdImage)->setRenderingFunction(MemoryDrawing::RENDERING_JPEG)->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); $oSlide->addShape($oShape); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $element = '/manifest:manifest/manifest:file-entry[5]'; $this->assertTrue($pres->elementExists($element, 'META-INF/manifest.xml')); $this->assertEquals('Pictures/'.$oShape->getIndexedFilename(), $pres->getElementAttribute($element, 'manifest:full-path', 'META-INF/manifest.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php similarity index 76% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php index 83f62b797..a741d2c1d 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php @@ -1,34 +1,34 @@ setDocumentLayout(DocumentLayout::LAYOUT_A4, true); - $phpPowerPoint->setLayout($oDocumentLayout); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $oPhpPresentation->setLayout($oDocumentLayout); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $this->assertTrue($pres->elementExists($element, 'styles.xml')); $this->assertEquals('landscape', $pres->getElementAttribute($element, 'style:print-orientation', 'styles.xml')); $oDocumentLayout->setDocumentLayout(DocumentLayout::LAYOUT_A4, false); - $phpPowerPoint->setLayout($oDocumentLayout); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $oPhpPresentation->setLayout($oDocumentLayout); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $this->assertTrue($pres->elementExists($element, 'styles.xml')); $this->assertEquals('portrait', $pres->getElementAttribute($element, 'style:print-orientation', 'styles.xml')); } public function testCustomDocumentLayout() { - $phpPowerPoint = new PhpPowerpoint(); + $oPhpPresentation = new PhpPresentation(); $oDocumentLayout = new DocumentLayout(); $oDocumentLayout->setDocumentLayout(array('cx' => rand(1, 100),'cy' => rand(1, 100),)); - $phpPowerPoint->setLayout($oDocumentLayout); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $oPhpPresentation->setLayout($oDocumentLayout); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $element = "/office:document-styles/office:automatic-styles/style:page-layout"; $this->assertTrue($pres->elementExists($element, 'styles.xml')); @@ -79,12 +79,12 @@ public function testCustomDocumentLayout() public function testFillGradientLinearRichText() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape(); $oShape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FFFF7700'))->setEndColor(new Color('FFFFFFFF')); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $element = '/office:document-styles/office:styles/draw:gradient'; $this->assertEquals('gradient_'.$oShape->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:name', 'styles.xml')); @@ -96,12 +96,12 @@ public function testFillGradientLinearRichText() public function testFillSolidRichText() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -111,22 +111,22 @@ public function testFillSolidRichText() public function testGradientTable() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation'); $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(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText1 = $oSlide->createRichTextShape(); $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setLineStyle(Border::LINE_SINGLE); $arrayDashStyle = array( @@ -145,7 +145,7 @@ public function testStrokeDash() foreach ($arrayDashStyle as $style) { $oRichText1->getBorder()->setDashStyle($style); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php similarity index 57% rename from tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php rename to tests/PhpPresentation/Tests/Writer/ODPresentationTest.php index 62a25f7a5..72047913e 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php @@ -1,29 +1,29 @@ 'Content', 'manifest' => 'Manifest', @@ -42,16 +42,16 @@ public function testConstruct() 'drawing' => 'Drawing', ); - $phpPowerPoint = new PhpPowerpoint(); - $phpPowerPoint->getActiveSlide()->createDrawingShape(); - $object = new ODPresentation($phpPowerPoint); + $oPhpPresentation = new PhpPresentation(); + $oPhpPresentation->getActiveSlide()->createDrawingShape(); + $object = new ODPresentation($oPhpPresentation); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $object->getPHPPowerPoint()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); $this->assertEquals('./', $object->getDiskCachingDirectory()); foreach ($parts as $partName => $objectName) { $this->assertInstanceOf($objectPrefix . $objectName, $object->getWriterPart($partName)); } - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\HashTable', $object->getDrawingHashTable()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\HashTable', $object->getDrawingHashTable()); } /** @@ -59,18 +59,18 @@ public function testConstruct() */ public function testSave() { - $filename = tempnam(sys_get_temp_dir(), 'PHPPowerPoint'); - $imageFile = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/images/PHPPowerPointLogo.png'; + $filename = tempnam(sys_get_temp_dir(), 'PhpPresentation'); + $imageFile = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/images/PhpPresentationLogo.png'; - $phpPowerPoint = new PhpPowerpoint(); - $slide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $slide = $oPhpPresentation->getActiveSlide(); $slide->createRichTextShape(); $slide->createLineShape(10, 10, 10, 10); - $slide->createChartShape()->getPlotArea()->setType(new \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D()); + $slide->createChartShape()->getPlotArea()->setType(new \PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D()); $slide->createDrawingShape()->setName('Drawing')->setPath($imageFile); $slide->createTableShape()->createRow(); - $object = new ODPresentation($phpPowerPoint); + $object = new ODPresentation($oPhpPresentation); $object->save($filename); $this->assertTrue(file_exists($filename)); @@ -79,7 +79,7 @@ public function testSave() } /** - * Test get PHPPowerPoint exception + * Test get PhpPresentation exception * * @expectedException Exception * @expectedExceptionMessage Filename is empty @@ -95,21 +95,21 @@ public function testSaveEmpty() */ public function testGetWriterPartNull() { - $object = new ODPresentation(new PhpPowerpoint()); + $object = new ODPresentation(new PhpPresentation()); $this->assertNull($object->getWriterPart('foo')); } /** - * Test get PHPPowerPoint exception + * Test get PhpPresentation exception * * @expectedException Exception - * @expectedExceptionMessage No PHPPowerPoint assigned. + * @expectedExceptionMessage No PhpPresentation assigned. */ - public function testGetPHPPowerPointException() + public function testGetPhpPresentationException() { $object = new ODPresentation(); - $object->getPHPPowerPoint(); + $object->getPhpPresentation(); } /** @@ -117,7 +117,7 @@ public function testGetPHPPowerPointException() */ public function testSetGetUseDiskCaching() { - $object = new ODPresentation(new PhpPowerpoint()); + $object = new ODPresentation(new PhpPresentation()); $this->assertFalse($object->hasDiskCaching()); $object->setUseDiskCaching(true, sys_get_temp_dir()); @@ -132,7 +132,7 @@ public function testSetGetUseDiskCaching() */ public function testSetUseDiskCachingException() { - $object = new ODPresentation(new PhpPowerpoint()); + $object = new ODPresentation(new PhpPresentation()); $object->setUseDiskCaching(true, 'foo'); } } diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/AbstractPartTest.php similarity index 62% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/AbstractPartTest.php index 73f251a29..8003cf090 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/AbstractPartTest.php @@ -1,32 +1,32 @@ 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oArea = new Area(); @@ -61,7 +61,7 @@ public function testTypeArea() $oArea->addSeries($oSeries); $oShape->getPlotArea()->setType($oArea); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartBarTest.php similarity index 72% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartBarTest.php index 6d7d06e93..af195a5b2 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartBarTest.php @@ -1,30 +1,30 @@ 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oBar = new Bar(); @@ -65,7 +65,7 @@ public function testTypeBar() $oBar->addSeries($oSeries); $oShape->getPlotArea()->setType($oBar); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartTest.php similarity index 81% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartTest.php index c83346bd3..4aa9a6218 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ChartTest.php @@ -1,34 +1,34 @@ getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); - $stub = $this->getMockForAbstractClass('PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType'); + $stub = $this->getMockForAbstractClass('PhpOffice\PhpPresentation\Shape\Chart\Type\AbstractType'); $oShape->getPlotArea()->setType($stub); - TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); } public function testTitleVisibility() { $element = '/c:chartSpace/c:chart/c:autoTitleDeleted'; - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, '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->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); $this->assertEquals('1', $oXMLDoc->getElementAttribute($element, 'val', 'ppt/charts/'.$oShape->getIndexedFilename())); } @@ -103,8 +103,8 @@ public function testTypeBar3D() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oBar3D = new Bar3D(); @@ -117,7 +117,7 @@ public function testTypeBar3D() $oBar3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oBar3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); @@ -141,8 +141,8 @@ public function testTypeBar3DSubScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oBar3D = new Bar3D(); @@ -151,7 +151,7 @@ public function testTypeBar3DSubScript() $oBar3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oBar3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -168,8 +168,8 @@ public function testTypeBar3DSuperScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oBar3D = new Bar3D(); @@ -178,7 +178,7 @@ public function testTypeBar3DSuperScript() $oBar3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oBar3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -195,8 +195,8 @@ public function testTypeBar3DBarDirection() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oBar3D = new Bar3D(); @@ -205,7 +205,7 @@ public function testTypeBar3DBarDirection() $oBar3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oBar3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:barDir'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -222,8 +222,8 @@ public function testTypeLine() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oLine = new Line(); @@ -231,7 +231,7 @@ public function testTypeLine() $oLine->addSeries($oSeries); $oShape->getPlotArea()->setType($oLine); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); @@ -253,8 +253,8 @@ public function testTypeLineSubScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oLine = new Line(); @@ -263,7 +263,7 @@ public function testTypeLineSubScript() $oLine->addSeries($oSeries); $oShape->getPlotArea()->setType($oLine); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -280,8 +280,8 @@ public function testTypeLineSuperScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oLine = new Line(); @@ -290,7 +290,7 @@ public function testTypeLineSuperScript() $oLine->addSeries($oSeries); $oShape->getPlotArea()->setType($oLine); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -307,8 +307,8 @@ public function testTypePie() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie = new Pie(); @@ -321,7 +321,7 @@ public function testTypePie() $oPie->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); @@ -344,8 +344,8 @@ public function testTypePie3D() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie3D = new Pie3D(); @@ -358,7 +358,7 @@ public function testTypePie3D() $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); @@ -383,8 +383,8 @@ public function testTypePie3DExplosion() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie3D = new Pie3D(); @@ -393,7 +393,7 @@ public function testTypePie3DExplosion() $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:explosion'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -410,8 +410,8 @@ public function testTypePie3DSubScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie3D = new Pie3D(); @@ -420,7 +420,7 @@ public function testTypePie3DSubScript() $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -437,8 +437,8 @@ public function testTypePie3DSuperScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie3D = new Pie3D(); @@ -447,7 +447,7 @@ public function testTypePie3DSuperScript() $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -464,8 +464,8 @@ public function testTypeScatter() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oScatter = new Scatter(); @@ -473,7 +473,7 @@ public function testTypeScatter() $oScatter->addSeries($oSeries); $oShape->getPlotArea()->setType($oScatter); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); @@ -495,8 +495,8 @@ public function testTypeScatterSubScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oScatter = new Scatter(); @@ -505,7 +505,7 @@ public function testTypeScatterSubScript() $oScatter->addSeries($oSeries); $oShape->getPlotArea()->setType($oScatter); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); @@ -522,8 +522,8 @@ public function testTypeScatterSuperScript() 'E' => 2, ); - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oScatter = new Scatter(); @@ -532,7 +532,7 @@ public function testTypeScatterSuperScript() $oScatter->addSeries($oSeries); $oShape->getPlotArea()->setType($oScatter); - $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ContenTypesTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ContenTypesTest.php new file mode 100644 index 000000000..d1b4dce51 --- /dev/null +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/ContenTypesTest.php @@ -0,0 +1,50 @@ +setParentWriter(new ODPresentation()); + $oContentTypes->writeContentTypes(new PhpPresentation()); + } +} diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DrawingTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DrawingTest.php new file mode 100644 index 000000000..d86f6849a --- /dev/null +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DrawingTest.php @@ -0,0 +1,55 @@ +getActiveSlide(); + $oGroup = $oSlide->createGroup(); + + $oDrawing = new Drawing(); + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation)); + $this->assertEmpty($oDrawing->allDrawings($oPhpPresentation)); + + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPresentation)); + $this->assertCount(3, $oDrawing->allDrawings($oPhpPresentation)); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php similarity index 65% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php index d632d3e46..c489733b5 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php @@ -1,23 +1,23 @@ getLayouts(); @@ -43,7 +43,7 @@ public function testFindLayout() */ public function testFindLayoutException() { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; $templateBased = new TemplateBased($file); $name = 'Invalid'; $templateBased->findLayout($name); @@ -51,7 +51,7 @@ public function testFindLayoutException() public function testFindLayoutId() { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; $templateBased = new TemplateBased($file); $layouts = $templateBased->getLayouts(); @@ -66,7 +66,7 @@ public function testFindLayoutId() */ public function testFindLayoutIdException() { - $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; $templateBased = new TemplateBased($file); $name = 'Invalid'; $templateBased->findLayoutId($name); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/PptPropsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPropsTest.php similarity index 61% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/PptPropsTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPropsTest.php index 1f0d4b967..45f68477e 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/PptPropsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPropsTest.php @@ -1,25 +1,25 @@ assertTrue($pres->elementExists($element, 'ppt/presProps.xml')); $this->assertEquals('{E76CE94A-603C-4142-B9EB-6D1370010A27}', $pres->getElementAttribute($element, 'uri', 'ppt/presProps.xml')); @@ -48,9 +48,9 @@ public function testPresProps() public function testTableStyles() { - $phpPowerPoint = new PhpPowerpoint(); + $oPhpPresentation = new PhpPresentation(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/a:tblStyleLst'; $this->assertTrue($pres->elementExists($element, 'ppt/tableStyles.xml')); $this->assertEquals('{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}', $pres->getElementAttribute($element, 'def', 'ppt/tableStyles.xml')); @@ -58,9 +58,9 @@ public function testTableStyles() public function testViewProps() { - $phpPowerPoint = new PhpPowerpoint(); + $oPhpPresentation = new PhpPresentation(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:viewPr'; $this->assertTrue($pres->elementExists($element, 'ppt/viewProps.xml')); $this->assertEquals('0', $pres->getElementAttribute($element, 'showComments', 'ppt/viewProps.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/SlideTest.php similarity index 80% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007/SlideTest.php index 7dfaedcf4..5e31db44e 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/SlideTest.php @@ -1,34 +1,34 @@ getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape()->setWidth(400)->setHeight(400)->setOffsetX(100)->setOffsetY(100); $oShape->createTextRun('this text should be vertically aligned'); $oShape->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_AUTO); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertFalse($pres->attributeElementExists($element, 'anchor', 'ppt/slides/slide1.xml')); } /** - * @link https://github.com/PHPOffice/PHPPowerPoint/issues/42 + * @link https://github.com/PHPOffice/PHPPresentation/issues/42 */ public function testAlignmentShapeBase() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape()->setWidth(400)->setHeight(400)->setOffsetX(100)->setOffsetY(100); $oShape->createTextRun('this text should be vertically aligned'); $oShape->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_BASE); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertFalse($pres->attributeElementExists($element, 'anchor', 'ppt/slides/slide1.xml')); } /** - * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35 + * @link https://github.com/PHPOffice/PHPPresentation/issues/35 */ public function testAlignmentShapeBottom() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape()->setWidth(400)->setHeight(400)->setOffsetX(100)->setOffsetY(100); $oShape->createTextRun('this text should be vertically aligned'); $oShape->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_BOTTOM); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals(Alignment::VERTICAL_BOTTOM, $pres->getElementAttribute($element, 'anchor', 'ppt/slides/slide1.xml')); } /** - * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35 + * @link https://github.com/PHPOffice/PHPPresentation/issues/35 */ public function testAlignmentShapeCenter() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape()->setWidth(400)->setHeight(400)->setOffsetX(100)->setOffsetY(100); $oShape->createTextRun('this text should be vertically aligned'); $oShape->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals(Alignment::VERTICAL_CENTER, $pres->getElementAttribute($element, 'anchor', 'ppt/slides/slide1.xml')); } /** - * @link https://github.com/PHPOffice/PHPPowerPoint/issues/35 + * @link https://github.com/PHPOffice/PHPPresentation/issues/35 */ public function testAlignmentShapeTop() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape()->setWidth(400)->setHeight(400)->setOffsetX(100)->setOffsetY(100); $oShape->createTextRun('this text should be vertically aligned'); $oShape->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_TOP); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals(Alignment::VERTICAL_TOP, $pres->getElementAttribute($element, 'anchor', 'ppt/slides/slide1.xml')); @@ -142,13 +142,13 @@ public function testAlignmentShapeTop() public function testDrawingWithHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createDrawingShape(); - $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); - $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -157,13 +157,13 @@ public function testDrawingWithHyperlink() public function testDrawingShapeBorder() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createDrawingShape(); - $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); $oShape->getBorder()->setLineStyle(Border::LINE_DOUBLE); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:pic/p:spPr/a:ln'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -172,13 +172,13 @@ public function testDrawingShapeBorder() public function testDrawingShapeShadow() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createDrawingShape(); - $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->setPath(PHPPRESENTATION_TESTS_BASE_DIR.'/resources/images/PhpPresentationLogo.png'); $oShape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:pic/p:spPr/a:effectLst/a:outerShdw'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -189,8 +189,8 @@ public function testFillGradientLinearTable() $expected1 = 'E06B20'; $expected2 = strrev($expected1); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(1); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -199,7 +199,7 @@ public function testFillGradientLinearTable() $oFill = $oCell->getFill(); $oFill->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -210,21 +210,21 @@ public function testFillGradientLinearTable() } /** - * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + * @link : https://github.com/PHPOffice/PHPPresentation/issues/61 */ public function testFillGradientLinearRichText() { $expected1 = 'E06B20'; $expected2 = strrev($expected1); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -239,8 +239,8 @@ public function testFillGradientPathTable() $expected1 = 'E06B20'; $expected2 = strrev($expected1); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(1); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -249,7 +249,7 @@ public function testFillGradientPathTable() $oFill = $oCell->getFill(); $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -260,21 +260,21 @@ public function testFillGradientPathTable() } /** - * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + * @link : https://github.com/PHPOffice/PHPPresentation/issues/61 */ public function testFillGradientPathText() { $expected1 = 'E06B20'; $expected2 = strrev($expected1); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createRichTextShape(); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oFill = $oShape->getFill(); $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -289,8 +289,8 @@ public function testFillPatternTable() $expected1 = 'E06B20'; $expected2 = strrev($expected1); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(1); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -299,7 +299,7 @@ public function testFillPatternTable() $oFill = $oCell->getFill(); $oFill->setFillType(Fill::FILL_PATTERN_LIGHTTRELLIS)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:pattFill/a:fgClr/a:srgbClr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -313,8 +313,8 @@ public function testFillSolidTable() { $expected = 'E06B20'; - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(1); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -323,7 +323,7 @@ public function testFillSolidTable() $oFill = $oCell->getFill(); $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF'.$expected)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:solidFill/a:srgbClr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -331,20 +331,20 @@ public function testFillSolidTable() } /** - * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + * @link : https://github.com/PHPOffice/PHPPresentation/issues/61 */ public function testFillSolidText() { $expected = 'E06B20'; - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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($oPhpPresentation, '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')); @@ -353,13 +353,13 @@ public function testFillSolidText() public function testHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRun = $oRichText->createTextRun('Delta'); $oRun->getHyperlink()->setUrl('http://www.google.fr'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:hlinkClick'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -367,13 +367,13 @@ public function testHyperlink() public function testHyperlinkInternal() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRun = $oRichText->createTextRun('Delta'); $oRun->getHyperlink()->setSlideNumber(1); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:hlinkClick'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -382,8 +382,8 @@ public function testHyperlinkInternal() public function testListBullet() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); $oExpectedFont = $oRichText->getActiveParagraph()->getBulletStyle()->getBulletFont(); @@ -393,7 +393,7 @@ public function testListBullet() $oRichText->createParagraph()->createTextRun('Delta'); $oRichText->createParagraph()->createTextRun('Epsilon'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr'; $this->assertTrue($pres->elementExists($element.'/a:buFont', 'ppt/slides/slide1.xml')); @@ -404,8 +404,8 @@ public function testListBullet() public function testListNumeric() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_NUMERIC); $oRichText->getActiveParagraph()->getBulletStyle()->setBulletNumericStyle(Bullet::NUMERIC_EA1CHSPERIOD); @@ -418,7 +418,7 @@ public function testListNumeric() $oRichText->createParagraph()->createTextRun('Delta'); $oRichText->createParagraph()->createTextRun('Epsilon'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr'; $this->assertTrue($pres->elementExists($element.'/a:buFont', 'ppt/slides/slide1.xml')); @@ -433,14 +433,14 @@ public function testLine() $valEmu10 = Drawing::pixelsToEmu(10); $valEmu90 = Drawing::pixelsToEmu(90); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oSlide->createLineShape(10, 10, 100, 100); $oSlide->createLineShape(100, 10, 10, 100); $oSlide->createLineShape(10, 100, 100, 10); $oSlide->createLineShape(100, 100, 10, 10); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:cxnSp/p:spPr/a:prstGeom'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -458,13 +458,13 @@ public function testLine() public function testNote() { - $oPHPPowerPoint = new PhpPowerpoint(); - $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oNote = $oSlide->getNote(); $oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600); $oRichText->createTextRun('testNote'); - $pres = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -480,13 +480,13 @@ public function testNote() public function testRichTextAutoFitNormal() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -495,12 +495,12 @@ public function testRichTextAutoFitNormal() public function testRichTextBreak() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createBreak(); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:br'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -508,12 +508,12 @@ public function testRichTextBreak() public function testRichTextHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->getHyperLink()->setUrl('http://www.google.fr'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp//a:hlinkClick'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -521,13 +521,13 @@ public function testRichTextHyperlink() public function testRichTextShadow() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('AAA'); $oRichText->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -535,13 +535,13 @@ public function testRichTextShadow() public function testRichTextUpright() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('AAA'); $oRichText->setUpright(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -550,13 +550,13 @@ public function testRichTextUpright() public function testRichTextVertical() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('AAA'); $oRichText->setVertical(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -565,13 +565,13 @@ public function testRichTextVertical() public function testStyleSubScript() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRun = $oRichText->createTextRun('pText'); $oRun->getFont()->setSubScript(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -580,13 +580,13 @@ public function testStyleSubScript() public function testStyleSuperScript() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRun = $oRichText->createTextRun('pText'); $oRun->getFont()->setSuperScript(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -595,8 +595,8 @@ public function testStyleSuperScript() public function testTableWithAlignment() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(4); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -604,7 +604,7 @@ public function testTableWithAlignment() $oCell->createTextRun('AAA'); $oCell->getActiveParagraph()->getAlignment()->setVertical(Alignment::VERTICAL_BOTTOM); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -613,8 +613,8 @@ public function testTableWithAlignment() public function testTableWithBorder() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(4); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -638,7 +638,7 @@ public function testTableWithBorder() $oCell->getBorders()->getBottom()->setDashStyle(Border::DASH_LARGEDASHDOTDOT); $oCell->getBorders()->getBottom()->setLineStyle(Border::LINE_NONE); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr'; $this->assertTrue($pres->elementExists($element.'/a:lnL[@cmpd="'.Border::LINE_THINTHICK.'"]', 'ppt/slides/slide1.xml')); @@ -653,8 +653,8 @@ public function testTableWithBorder() public function testTableWithColspan() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(4); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -662,7 +662,7 @@ public function testTableWithColspan() $oCell->createTextRun('AAA'); $oCell->setColSpan(2); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); @@ -671,8 +671,8 @@ public function testTableWithColspan() public function testTableWithRowspan() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(4); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); $oRow = $oShape->createRow(); @@ -684,7 +684,7 @@ public function testTableWithRowspan() $oCell = $oRow->getCell(); $oCell->createTextRun('BBB'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc'; $this->assertTrue($pres->elementExists($element.'[@rowSpan="2"]', 'ppt/slides/slide1.xml')); @@ -692,21 +692,21 @@ public function testTableWithRowspan() } /** - * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/70 + * @link : https://github.com/PHPOffice/PHPPresentation/issues/70 */ public function testTableWithHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->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/'); + $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPresentation/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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')); @@ -719,36 +719,36 @@ public function testTransition() $oTransition = new Transition(); - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); $element = '/p:sld/p:transition'; - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertFalse($pres->elementExists($element, 'ppt/slides/slide1.xml')); $oTransition->setTimeTrigger(true, $value); $oSlide->setTransition($oTransition); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, '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'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertContains('fast', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); $oTransition->setSpeed(Transition::SPEED_MEDIUM); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertContains('med', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); $oTransition->setSpeed(Transition::SPEED_SLOW); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertContains('slow', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); - $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); + $rcTransition = new \ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { if (strpos($key, 'TRANSITION_') !== 0) { @@ -757,7 +757,7 @@ public function testTransition() $oTransition->setTransitionType($rcTransition->getConstant($key)); $oSlide->setTransition($oTransition); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertTrue($pres->elementExists($element.'/p:blinds[@dir=\'horz\']', 'ppt/slides/slide1.xml')); @@ -907,7 +907,7 @@ public function testTransition() } $oTransition->setManualTrigger(true); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertContains('1', $pres->getElementAttribute($element, 'advClick', 'ppt/slides/slide1.xml')); } } diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007Test.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php similarity index 62% rename from tests/PhpPowerpoint/Tests/Writer/PowerPoint2007Test.php rename to tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php index 07921958b..8c0abf169 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007Test.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php @@ -1,24 +1,24 @@ 'ContentTypes', 'docprops' => 'DocProps', @@ -44,16 +44,16 @@ public function testConstruct() 'chart' => 'Chart', ); - $phpPowerPoint = new PhpPowerpoint(); - $object = new PowerPoint2007($phpPowerPoint); + $oPhpPresentation = new PhpPresentation(); + $object = new PowerPoint2007($oPhpPresentation); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\PhpPowerpoint', $object->getPhpPowerpoint()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); $this->assertEquals('./', $object->getDiskCachingDirectory()); $this->assertInstanceOf("{$objectPrefix}LayoutPack\\PackDefault", $object->getLayoutPack()); foreach ($parts as $partName => $objectName) { $this->assertInstanceOf($objectPrefix . $objectName, $object->getWriterPart($partName)); } - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\HashTable', $object->getDrawingHashTable()); + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\HashTable', $object->getDrawingHashTable()); } /** @@ -61,18 +61,18 @@ public function testConstruct() */ public function testSave() { - $filename = tempnam(sys_get_temp_dir(), 'PHPPowerPoint'); - $imageFile = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/images/PHPPowerPointLogo.png'; + $filename = tempnam(sys_get_temp_dir(), 'PhpPresentation'); + $imageFile = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/images/PhpPresentationLogo.png'; - $phpPowerPoint = new PhpPowerpoint(); - $slide = $phpPowerPoint->getActiveSlide(); + $oPhpPresentation = new PhpPresentation(); + $slide = $oPhpPresentation->getActiveSlide(); $slide->createRichTextShape(); $slide->createLineShape(10, 10, 10, 10); - $slide->createChartShape()->getPlotArea()->setType(new \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D()); + $slide->createChartShape()->getPlotArea()->setType(new \PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D()); $slide->createDrawingShape()->setName('Drawing')->setPath($imageFile); $slide->createTableShape()->createRow(); - $object = new PowerPoint2007($phpPowerPoint); + $object = new PowerPoint2007($oPhpPresentation); $object->save($filename); $this->assertTrue(file_exists($filename)); @@ -85,21 +85,21 @@ public function testSave() */ public function testGetWriterPartNull() { - $object = new PowerPoint2007(new PhpPowerpoint()); + $object = new PowerPoint2007(new PhpPresentation()); $this->assertNull($object->getWriterPart('foo')); } /** - * Test get PHPPowerPoint exception + * Test get PhpPresentation exception * * @expectedException Exception - * @expectedExceptionMessage No PHPPowerPoint assigned. + * @expectedExceptionMessage No PhpPresentation assigned. */ - public function testGetPHPPowerPointException() + public function testGetPhpPresentationException() { $object = new PowerPoint2007(); - $object->getPhpPowerpoint(); + $object->getPhpPresentation(); } /** @@ -107,7 +107,7 @@ public function testGetPHPPowerPointException() */ public function testSetHasOffice2003Compatibility() { - $object = new PowerPoint2007(new PhpPowerpoint()); + $object = new PowerPoint2007(new PhpPresentation()); $this->assertFalse($object->hasOffice2003Compatibility()); $object->setOffice2003Compatibility(true); @@ -119,7 +119,7 @@ public function testSetHasOffice2003Compatibility() */ public function testSetGetUseDiskCaching() { - $object = new PowerPoint2007(new PhpPowerpoint()); + $object = new PowerPoint2007(new PhpPresentation()); $this->assertFalse($object->hasDiskCaching()); $object->setUseDiskCaching(true, sys_get_temp_dir()); @@ -134,7 +134,7 @@ public function testSetGetUseDiskCaching() */ public function testSetUseDiskCachingException() { - $object = new PowerPoint2007(new PhpPowerpoint()); + $object = new PowerPoint2007(new PhpPresentation()); $object->setUseDiskCaching(true, 'foo'); } } diff --git a/tests/PhpPresentation/Tests/Writer/SerializedTest.php b/tests/PhpPresentation/Tests/Writer/SerializedTest.php new file mode 100644 index 000000000..1a50426cb --- /dev/null +++ b/tests/PhpPresentation/Tests/Writer/SerializedTest.php @@ -0,0 +1,109 @@ +assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage No PhpPresentation assigned. + */ + public function testEmptyConstruct() + { + $object = new Serialized(); + $object->getPhpPresentation(); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Filename is empty. + */ + public function testSaveEmpty() + { + $object = new Serialized(new PhpPresentation()); + $object->save(''); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage PhpPresentation object unassigned. + */ + public function testSaveNoObject() + { + $object = new Serialized(); + $object->save('file.phpppt'); + } + + public function testSave() + { + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); + $oImage = $oSlide->createDrawingShape(); + $oImage->setPath(PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PhpPresentationLogo.png'); + $object = new Serialized($oPhpPresentation); + + $file = tempnam(sys_get_temp_dir(), 'PhpPresentation_Serialized'); + + $this->assertFileExists($file, $object->save($file)); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not open + */ + public function testSaveNotExistingDir() + { + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); + $oImage = $oSlide->createDrawingShape(); + $oImage->setPath(PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PhpPresentationLogo.png'); + $object = new Serialized($oPhpPresentation); + + $file = tempnam(sys_get_temp_dir(), 'PhpPresentation_Serialized'); + + $this->assertFileExists($file, $object->save($file.DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR.'test')); + } + + public function testSaveOverwriting() + { + $oPhpPresentation = new PhpPresentation(); + $oSlide = $oPhpPresentation->getActiveSlide(); + $oImage = $oSlide->createDrawingShape(); + $oImage->setPath(PHPPRESENTATION_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PhpPresentationLogo.png'); + $object = new Serialized($oPhpPresentation); + + $file = tempnam(sys_get_temp_dir(), 'PhpPresentation_Serialized'); + file_put_contents($file, rand(1, 100)); + + $this->assertFileExists($file, $object->save($file)); + } +} diff --git a/tests/PhpPowerpoint/Tests/_includes/TestHelperDOCX.php b/tests/PhpPresentation/Tests/_includes/TestHelperDOCX.php similarity index 54% rename from tests/PhpPowerpoint/Tests/_includes/TestHelperDOCX.php rename to tests/PhpPresentation/Tests/_includes/TestHelperDOCX.php index 2ea7bbc5b..0910488c2 100644 --- a/tests/PhpPowerpoint/Tests/_includes/TestHelperDOCX.php +++ b/tests/PhpPresentation/Tests/_includes/TestHelperDOCX.php @@ -1,24 +1,24 @@ save(self::$file); $zip = new \ZipArchive; $res = $zip->open(self::$file); if ($res === true) { - $zip->extractTo(sys_get_temp_dir() . '/PhpPowerpoint_Unit_Test/'); + $zip->extractTo(sys_get_temp_dir() . '/PhpPresentation_Unit_Test/'); $zip->close(); } - return new XmlDocument(sys_get_temp_dir() . '/PhpPowerpoint_Unit_Test/'); + return new XmlDocument(sys_get_temp_dir() . '/PhpPresentation_Unit_Test/'); } /** @@ -67,8 +67,8 @@ public static function clear() if (file_exists(self::$file)) { unlink(self::$file); } - if (is_dir(sys_get_temp_dir() . '/PhpPowerpoint_Unit_Test/')) { - self::deleteDir(sys_get_temp_dir() . '/PhpPowerpoint_Unit_Test/'); + if (is_dir(sys_get_temp_dir() . '/PhpPresentation_Unit_Test/')) { + self::deleteDir(sys_get_temp_dir() . '/PhpPresentation_Unit_Test/'); } } diff --git a/tests/PhpPowerpoint/Tests/_includes/XmlDocument.php b/tests/PhpPresentation/Tests/_includes/XmlDocument.php similarity index 89% rename from tests/PhpPowerpoint/Tests/_includes/XmlDocument.php rename to tests/PhpPresentation/Tests/_includes/XmlDocument.php index 89b309086..5320241fb 100644 --- a/tests/PhpPowerpoint/Tests/_includes/XmlDocument.php +++ b/tests/PhpPresentation/Tests/_includes/XmlDocument.php @@ -1,21 +1,21 @@