Skip to content

Commit

Permalink
Feedbacks from @Progi1984
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jan 17, 2024
1 parent 0e5dd85 commit c6231bb
Show file tree
Hide file tree
Showing 53 changed files with 1,019 additions and 1,291 deletions.
13 changes: 13 additions & 0 deletions docs/changes/1.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@
- PowerPoint2007 Reader
- PowerPoint2007 Writer
- PowerPoint2007 Writer: Enable style and position of a Placeholder - [@qmachard](https://github.com/qmachard) in [#787](https://github.com/PHPOffice/PHPPresentation/pull/787)
- PowerPoint2007 Reader: Added support for thumbnail - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)

## Improvements
- Slide : Raised max value for identifier rand call - [@Scheissy](https://github.com/Scheissy) in [#777](https://github.com/PHPOffice/PHPPresentation/pull/777)
- Document Properties : Support for Revision & Status - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)
- PowerPoint2007 Reader
- PowerPoint2007 Writer
- Presentation Properties : Added support to define content of the thumbnail - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)
- Font : Support for Strikethrough mode - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)
- PowerPoint2007 Reader
- PowerPoint2007 Writer
- Font : Support for Pitch Family, Charset & Panose - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)
- PowerPoint2007 Reader
- PowerPoint2007 Writer
(@todo Doc)
- Font : Replaced Superscript/Subscript by baseline in PowerPoint2007 Writer - [@devX2712](https://github.com/devX2712) in [#788](https://github.com/PHPOffice/PHPPresentation/pull/787)

## Bugfixes

Expand Down
32 changes: 31 additions & 1 deletion docs/usage/presentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ $properties->setCreated(mktime(0, 0, 0, 3, 12, 2014));
$properties->setModified(mktime(0, 0, 0, 3, 14, 2014));
$properties->setSubject('My subject');
$properties->setKeywords('my, key, word');
$properties->setStatus('Work in Progress');
$properties->setRevision('Version 1.2.3');
```

### Custom Properties
Expand Down Expand Up @@ -203,16 +205,44 @@ echo $properties->getSlideshowType();

You can define the thumbnail of the presentation with the method `setThumbnailPath`.


#### From a file
``` php
<?php

use PhpOffice\PhpPresentation\PresentationProperties;

$presentation = new PhpPresentation();

$properties = $presentation->getPresentationProperties();
// Set path of the thumbnail
$properties->setThumbnailPath(__DIR__.'\resources\phppowerpoint_logo.gif');
$properties->setThumbnailPath(
__DIR__.'\resources\phppowerpoint_logo.gif',
PresentationProperties::THUMBNAIL_FILE
);
// Get path of the thumbnail
echo $properties->getThumbnailPath();
// Get content of the thumbnail
echo $properties->getThumbnail();
```

#### From the content of the file
``` php
<?php

use PhpOffice\PhpPresentation\PresentationProperties;

$presentation = new PhpPresentation();

$properties = $presentation->getPresentationProperties();
// Set path of the thumbnail
$properties->setThumbnailPath(
'',
PresentationProperties::THUMBNAIL_DATA,
file_get_contents(__DIR__.'\resources\phppowerpoint_logo.gif')
);
// Get content of the thumbnail
echo $properties->getThumbnail();
```

### Zoom
Expand Down
35 changes: 32 additions & 3 deletions docs/usage/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,24 @@ echo $alignment->isRTL();
- `name`
- `bold`
- `italic`
- `superScript`
- `subScript`
- `superScript` (deprecated)
- `subScript` (deprecated)
- `underline`
- `strikethrough`
- `color`
- `capitalization`
- `pitchFamily`
- `charset`

### Baseline

The baseline set the position relative to the line.
The value is a percentage.

You can use some predefined values :

* `Font::BASELINE_SUPERSCRIPT` (= 300000 = 300%)
* `Font::BASELINE_SUBSCRIPT` (= -250000 = -250%)


### Capitalization

Expand Down Expand Up @@ -145,6 +157,23 @@ $font->setFormat(Font::FORMAT_EAST_ASIAN);
// Get format of font
echo $font->getFormat();
```

### Panose
The support of Panose 1.0 is only used.

``` php
<?php

use PhpOffice\PhpPresentation\Style\Font;

$font = new Font();

// Set panose of font
$font->setPanose('4494D72242');
// Get panose of font
echo $font->getPanose();
```

## Bullet

- `bulletType`
Expand Down
3 changes: 2 additions & 1 deletion samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt): void
}
}
$oNote = $oSlide->getNote();
if ($oNote->getShapeCollection()->count() > 0) {
if (count($oNote->getShapeCollection()) > 0) {
$this->append('<dt>Notes</dt>');
foreach ($oNote->getShapeCollection() as $oShape) {
if ($oShape instanceof RichText) {
Expand Down Expand Up @@ -442,6 +442,7 @@ protected function displayShapeInfo(AbstractShape $oShape): void
$this->append('<abbr title="Italic">Italic</abbr> : ' . ($oRichText->getFont()->isItalic() ? 'Y' : 'N') . ' - ');
$this->append('<abbr title="Underline">Underline</abbr> : Underline::' . $this->getConstantName('\PhpOffice\PhpPresentation\Style\Font', $oRichText->getFont()->getUnderline()) . ' - ');
$this->append('<abbr title="Strikethrough">Strikethrough</abbr> : ' . ($oRichText->getFont()->isStrikethrough() ? 'Y' : 'N') . ' - ');
$this->append('<abbr title="Baseline">Baseline</abbr> : ' . $oRichText->getFont()->getBaseline() . ' - ');
$this->append('<abbr title="SubScript">SubScript</abbr> : ' . ($oRichText->getFont()->isSubScript() ? 'Y' : 'N') . ' - ');
$this->append('<abbr title="SuperScript">SuperScript</abbr> : ' . ($oRichText->getFont()->isSuperScript() ? 'Y' : 'N'));
$this->append('</dd>');
Expand Down
77 changes: 8 additions & 69 deletions src/PhpPresentation/AbstractShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace PhpOffice\PhpPresentation;

use PhpOffice\PhpPresentation\Exception\ShapeContainerAlreadyAssignedException;
use PhpOffice\PhpPresentation\Shape\Group;
use PhpOffice\PhpPresentation\Shape\Hyperlink;
use PhpOffice\PhpPresentation\Shape\Placeholder;
use PhpOffice\PhpPresentation\Style\Border;
Expand Down Expand Up @@ -102,12 +103,6 @@ abstract class AbstractShape implements ComparableInterface
*/
protected $placeholder;

/**
* List of effect apply to shape
* @var array \PhpOffice\PhpPresentation\Style\Effect[]
*/
protected ?array $effectCollection = null;

/**
* Hash index
*
Expand All @@ -131,7 +126,6 @@ public function __construct()
$this->fill = new Fill();
$this->shadow = new Shadow();
$this->border = new Border();
$this->effectCollection = null;

$this->border->setLineStyle(Style\Border::LINE_NONE);
}
Expand All @@ -143,12 +137,10 @@ public function __clone()
{
$this->container = null;
$this->name = $this->name;
$this->border = clone $this->border;
if (isset($this->fill)) {
$this->fill = clone $this->fill;
}
if (isset($this->border)) {
$this->border = clone $this->border;
}
if (isset($this->shadow)) {
$this->shadow = clone $this->shadow;
}
Expand All @@ -158,11 +150,6 @@ public function __clone()
if (isset($this->hyperlink)) {
$this->hyperlink = clone $this->hyperlink;
}
// Clone each effect
if (isset($this->effectCollection)) {
foreach ($this->effectCollection as &$effect) {
$effect = clone $effect;
}}
}

/**
Expand All @@ -186,21 +173,18 @@ public function setContainer(?ShapeContainerInterface $pValue = null, $pOverride
// Add drawing to ShapeContainerInterface
$this->container = $pValue;
if (null !== $this->container) {
$this->container->getShapeCollection()->append($this);
$this->container->addShape($this);
}
} else {
if ($pOverrideOld) {
// Remove drawing from old ShapeContainerInterface
$iterator = $this->container->getShapeCollection()->getIterator();

while ($iterator->valid()) {
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
$this->container->getShapeCollection()->offsetUnset($iterator->key());
foreach ($this->container->getShapeCollection() as $key => $shape) {
if ($shape->getHashCode() == $this->getHashCode()) {
$this->container->unsetShape($key);
$this->container = null;

break;
}
$iterator->next();
}

// Set new \PhpOffice\PhpPresentation\Slide
Expand All @@ -215,21 +199,16 @@ public function setContainer(?ShapeContainerInterface $pValue = null, $pOverride

/**
* Get Name
*
* @return string
*/
public function getName()
public function getName(): string
{
return $this->name;
}

/**
* Set Name
*
* @param string $pValue
* @return \PhpOffice\PhpPresentation\Shape\AbstractGraphic
*/
public function setName($pValue = '')
public function setName(string $pValue = ''): static
{
$this->name = $pValue;
return $this;
Expand Down Expand Up @@ -423,46 +402,6 @@ public function setHyperlink(?Hyperlink $pHyperlink = null): self

return $this;
}

/**
* Add an effect to the shpae
*
* @param \PhpOffice\PhpPresentation\Style\Effect $effect
* @return $this
*/
public function addEffect(Shape\Effect $effect)
{
if (!isset($this->effectCollection)) {
$this->effectCollection = array();
}
$this->effectCollection[] = $effect;
return $this;
}

/**
* Get the effect collection
*
* @return array \PhpOffice\PhpPresentation\Style\Effect[]
*/
public function getEffectCollection():?array
{
return $this->effectCollection;
}

/**
* Set the effect collection
*
* @param array \PhpOffice\PhpPresentation\Style\Effect $effectCollection
* @return $this
*/
public function setEffectCollection(array $effectCollection)
{
if ( isset($effectCollection)
&& is_array($effectCollection)) {
$this->effectCollection = $effectCollection;
}
return $this;
}

/**
* Get hash code.
Expand Down
35 changes: 15 additions & 20 deletions src/PhpPresentation/DocumentProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,18 @@ class DocumentProperties
private $company;

/**
* revision
* Revision.
*
* @var string
*/
private $revision;

/**
* Status.
*
* @var string
*/
private $status;

/**
* Custom Properties.
Expand All @@ -116,14 +123,7 @@ class DocumentProperties
private $customProperties = [];

/**
* status
*
* @var string
*/
private $status;

/**
* Create a new \PhpOffice\PhpPresentation\DocumentProperties
* Create a new \PhpOffice\PhpPresentation\DocumentProperties.
*/
public function __construct()
{
Expand All @@ -139,7 +139,7 @@ public function __construct()
$this->category = '';
$this->company = 'Microsoft Corporation';
$this->revision = '';
$this->status = '';
$this->status = '';
}

/**
Expand Down Expand Up @@ -479,7 +479,7 @@ public function getRevision(): string
}

/**
* Set Revision
* Set Revision.
*/
public function setRevision(string $pValue = ''): self
{
Expand All @@ -489,22 +489,17 @@ public function setRevision(string $pValue = ''): self
}

/**
* Get Status
*
* @return string
* Get Status.
*/
public function getStatus()
public function getStatus(): string
{
return $this->status;
}

/**
* Set Status
*
* @param string $pValue
* @return \PhpOffice\PhpPresentation\DocumentProperties
* Set Status.
*/
public function setStatus($pValue = '')
public function setStatus(string $pValue = ''): self
{
$this->status = $pValue;

Expand Down
Loading

0 comments on commit c6231bb

Please sign in to comment.