Skip to content

Commit

Permalink
Merge pull request #174 from PHPOffice/develop
Browse files Browse the repository at this point in the history
Version 0.6
  • Loading branch information
Progi1984 committed Jan 24, 2016
2 parents 464b206 + 123a168 commit b70f7ea
Show file tree
Hide file tree
Showing 51 changed files with 1,358 additions and 86 deletions.
6 changes: 2 additions & 4 deletions .travis_shell_after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +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
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPPresentation" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then

echo -e "Publishing PHPDoc...\n"

Expand All @@ -16,8 +15,7 @@ if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPPowerPoint" ] && [ "$TRAVIS_PULL_REQUE
cd $HOME
git config --global user.email "[email protected]"
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
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPPresentation gh-pages > /dev/null

cd gh-pages
echo "--DEBUG : Suppression"
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# Changelog
## 0.6.0 - 2016-01-24

### Bugfix
- Documentation : Fixes in the rename of PHPPowerPoint - @Progi1984 GH-127
- ODPresentation : Exclude SVM files for reader - @Progi1984 GH-141
- PowerPoint2007 Writer : Bugfix for opening PPTX on Mac - @thsteinmetz GH-89

### Changes
- PhpOffice\PhpPresentation\getProperties has been deprecated for PhpOffice\PhpPresentation\getDocumentProperties - @Progi1984 GH-154
- PhpOffice\PhpPresentation\setProperties has been deprecated for PhpOffice\PhpPresentation\setDocumentProperties - @Progi1984 GH-154
- PhpOffice\PhpPowerpoint\Style\Alignment::setLevel can now be defined great than 8 - @Progi1984 GH-141

### Features
- ODPresentation Reader/Writer : Name of the slide - @Progi1984 GH-121
- ODPresentation Reader/Writer : Slide Background Color or Image - @Progi1984 GH-152
- PowerPoint2007 Reader : Support for Layout Name - @Progi1984 GH-144
- PowerPoint2007 Reader/Writer : Mark as final - @Progi1984 GH-118
- PowerPoint2007 Reader/Writer : Set default zoom value for presentation - @Progi1984 GH-122
- PowerPoint2007 Reader/Writer : Slide Background Color or Image - @Progi1984 GH-152
- PowerPoint2007 Reader/Writer : Add Properties for allowing loop continuously until 'Esc' - @Progi1984 GH-154

## 0.5.0 - 2015-10-08

### Features
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ![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)
[![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPPresentation)
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/badges/quality-score.png?s=b5997ce59ac2816b4514f3a38de9900f6d492c1d)](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/)
[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/)
[![Total Downloads](https://poser.pugx.org/phpoffice/phppowerpoint/downloads.png)](https://packagist.org/packages/phpoffice/phppowerpoint)
Expand All @@ -11,7 +11,7 @@

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).

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/).
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/PHPPresentation) 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 PHPPresentation:

Expand Down Expand Up @@ -79,7 +79,7 @@ require_once 'src/PhpPresentation/Autoloader.php';
// with Composer
require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\PhpPowerpoint;
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\Style\Alignment;
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ the verbose class names will need to be updated accordingly.

Why PHPPowerPoint become PHPPresentation ?
------------------------------------------
As `Roman Syroeshko noticed us <https://github.com/PHPOffice/PHPPowerPoint/issues/25>`__, PowerPoint is a `trademark <http://www.microsoft.com/en-us/legal/IntellectualProperty/Trademarks/EN-US.aspx#332b86b0-befe-4b89-862e-d538e2a653e0>`__.
As `Roman Syroeshko noticed us <https://github.com/PHPOffice/PHPPresentation/issues/25>`__, PowerPoint is a `trademark <http://www.microsoft.com/en-us/legal/IntellectualProperty/Trademarks/EN-US.aspx#332b86b0-befe-4b89-862e-d538e2a653e0>`__.
For avoiding any problems with Microsoft, we decide to change the name to a more logic name, with our panel of readers/writers.
12 changes: 12 additions & 0 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ Writers
+---------------------------+----------------------+--------+-------+-------+-------+
| Features | | PPTX | ODP | HTML | PDF |
+===========================+======================+========+=======+=======+=======+
| **Document** | Mark as final || | | |
+---------------------------+----------------------+--------+-------+-------+-------+
| **Document Properties** | Standard ||| | |
+---------------------------+----------------------+--------+-------+-------+-------+
| | Custom | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+
| **Slides** | ||| | |
+---------------------------+----------------------+--------+-------+-------+-------+
| | Name | || | |
+---------------------------+----------------------+--------+-------+-------+-------+
| **Element Shape** | Image ||| | |
+---------------------------+----------------------+--------+-------+-------+-------+
| | Hyperlink ||| | |
Expand Down Expand Up @@ -74,10 +80,16 @@ Readers
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| Features | | PPTX | ODP | HTML | PDF | PPT |
+===========================+======================+========+=======+=======+=======+=======+
| **Document** | Mark as final || | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Document Properties** | Standard ||| | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Custom | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Slides** | ||| | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Name | || | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Element Shape** | Image ||| | ||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Hyperlink ||| | ||
Expand Down
46 changes: 42 additions & 4 deletions docs/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,49 @@
Recipes
=======

Title
-----------------------
How to define the zoom of a presentation ?
------------------------------------------

Recipe Text
You must define the zoom of your presentation with the method ``setZoom()``

.. code-block:: php
$content;
// Default
$zoom = $oPHPPresentation->getZoom();
// $zoom = 1
// Without parameter
$oPHPPresentation->setZoom();
$zoom = $oPHPPresentation->getZoom();
// $zoom = true
// Parameter = false
$oPHPPresentation->setZoom(2.8);
$zoom = $oPHPPresentation->getZoom();
// $zoom = 2.8
How to mark a presentation as final ?
-------------------------------------

You must define your presentation as it with the method ``markAsFinal()``

.. code-block:: php
// Default
$state = $oPHPPresentation->isMarkedAsFinal();
// $state = false
// Without parameter
$oPHPPresentation->markAsFinal();
$state = $oPHPPresentation->isMarkedAsFinal();
// $state = true
// Parameter = false
$oPHPPresentation->markAsFinal(false);
$state = $oPHPPresentation->isMarkedAsFinal();
// $state = false
// Parameter = true
$oPHPPresentation->markAsFinal(true);
$state = $oPHPPresentation->isMarkedAsFinal();
// $state = true
11 changes: 11 additions & 0 deletions docs/slides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ Slides
======

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.

Name
-------

By default, a slide has not a name.
You can define it with the method ``setName``.

.. code-block:: php
$oSlide = $oPHPPresentation->createSlide();
$oSlide->setName('Title of the slide');
26 changes: 26 additions & 0 deletions samples/Sample_13_MarkAsFinal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

include_once 'Sample_Header.php';

use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Color;

// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();

// Mark the document as final
$objPHPPresentation->markAsFinal(true);

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();
$currentSlide->addShape(clone $oShapeDrawing);
$currentSlide->addShape(clone $oShapeRichText);

// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
26 changes: 26 additions & 0 deletions samples/Sample_14_Zoom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

include_once 'Sample_Header.php';

use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Color;

// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();

// Set the zoom to 200%
$objPHPPresentation->setZoom(3);

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();
$currentSlide->addShape(clone $oShapeDrawing);
$currentSlide->addShape(clone $oShapeRichText);

// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
43 changes: 43 additions & 0 deletions samples/Sample_15_Background.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

include_once 'Sample_Header.php';

use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Slide\Background\Color;
use PhpOffice\PhpPresentation\Style\Color as StyleColor;
use \PhpOffice\PhpPresentation\Slide\Background\Image;

// 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;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);

// Slide > Background > Color
$oBkgColor = new Color();
$oBkgColor->setColor(new StyleColor(StyleColor::COLOR_DARKGREEN));
$oSlide1->setBackground($oBkgColor);

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide2 = $objPHPPresentation->createSlide();
$oSlide2->addShape(clone $oShapeDrawing);
$oSlide2->addShape(clone $oShapeRichText);

// Slide > Background > Image
/*
* @link : http://publicdomainarchive.com/public-domain-images-cave-red-rocks-light-beam-cavern/
*/
$oBkgImage = new Image();
$oBkgImage->setPath('./resources/background.jpg');
$oSlide2->setBackground($oBkgImage);

// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
38 changes: 38 additions & 0 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
use PhpOffice\PhpPresentation\Shape\RichText;
use PhpOffice\PhpPresentation\Shape\RichText\BreakElement;
use PhpOffice\PhpPresentation\Shape\RichText\TextElement;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Bullet;
use PhpOffice\PhpPresentation\Style\Color;

error_reporting(E_ALL);
define('CLI', (PHP_SAPI == 'cli') ? true : false);
Expand All @@ -41,6 +43,32 @@
$pageTitle .= 'PHPPresentation';
$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";

$oShapeDrawing = new Drawing();
$oShapeDrawing->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
$oShapeDrawing->getShadow()->setVisible(true)
->setDirection(45)
->setDistance(10);
$oShapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');

// Create a shape (text)
$oShapeRichText = new RichText();
$oShapeRichText->setHeight(300)
->setWidth(600)
->setOffsetX(170)
->setOffsetY(180);
$oShapeRichText->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
$textRun = $oShapeRichText->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)
->setSize(60)
->setColor( new Color( 'FFE06B20' ) );



// Populate samples
$files = '';
if ($handle = opendir('.')) {
Expand Down Expand Up @@ -254,6 +282,16 @@ protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt)
$this->append('<dt>Offset Y</dt><dd>'.$oSlide->getOffsetY().'</dd>');
$this->append('<dt>Extent X</dt><dd>'.$oSlide->getExtentX().'</dd>');
$this->append('<dt>Extent Y</dt><dd>'.$oSlide->getExtentY().'</dd>');
$oBkg = $oSlide->getBackground();
if ($oBkg instanceof Slide\AbstractBackground) {
if ($oBkg instanceof Slide\Background\Color) {
$this->append('<dt>Background Color</dt><dd>#'.$oBkg->getColor()->getRGB().'</dd>');
}
if ($oBkg instanceof Slide\Background\Image) {
$sBkgImgContents = file_get_contents($oBkg->getPath());
$this->append('<dt>Background Image</dt><dd><img src="data:image/png;base64,'.base64_encode($sBkgImgContents).'"></dd>');
}
}
$this->append('</dl>');
$this->append('</div>');

Expand Down
Binary file added samples/resources/PPTX_MarkAsFinal.pptx
Binary file not shown.
Binary file added samples/resources/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/PhpPresentation/AbstractShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function setHyperlink(Hyperlink $pHyperlink = null)
*/
public function getHashCode()
{
return md5((is_object($this->container)?$this->container->getHashCode():'') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . $this->getFill()->getHashCode() . $this->shadow->getHashCode() . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__);
return md5((is_object($this->container)?$this->container->getHashCode():'') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . $this->getFill()->getHashCode() . (is_null($this->shadow) ? '' : $this->shadow->getHashCode()) . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__);
}

/**
Expand Down
Loading

0 comments on commit b70f7ea

Please sign in to comment.