Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose some contributions developed for my project #684

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1ea39dd
Add read/write Revision document attribut
devX2712 Aug 14, 2020
6fc41b3
Conserve thumbnail if already exist in file
devX2712 Aug 14, 2020
27898cf
BUGFIX whe setting image ressource
devX2712 Aug 16, 2020
18b3c2c
BUGFIX While loading some kind of image (EMF)
devX2712 Aug 16, 2020
7de13f5
EVOL Move Shape name to AbstractShape
devX2712 Aug 16, 2020
c70b403
BUGFIX - Name, in shape, is not preserved if not a placeholder
devX2712 Sep 12, 2020
4ee33ec
CHG-Load also richtext shape without text
devX2712 Sep 12, 2020
4796c28
ADD-Preserve shape properties (background color, etc.) for richttext
devX2712 Sep 12, 2020
4fa8686
ADD-Shape RichtText preserve spelling lang while loading
devX2712 Sep 12, 2020
7ac99b8
ADD-Preserve shape richtext font face while loading file
devX2712 Sep 12, 2020
19c26f7
EVOL-Allow different style of strick paragraph
devX2712 Sep 13, 2020
866a7a2
EVOL-Define const for strike types
devX2712 Sep 13, 2020
3d1b3e2
EVOL-Super script and sub script for paragraph
devX2712 Sep 13, 2020
2cc01a7
EVOL-Add capitalize managment for paragraphe
devX2712 Sep 13, 2020
89d4d95
ADD Property 'status' reading and writing
devX2712 Jan 27, 2021
faa9610
BUGFIX while cloning an existant slide
devX2712 Feb 1, 2021
42b844c
ADD Read also texte zone margin RLTB
devX2712 Feb 2, 2021
a97e82c
ADD Vertical alignment for shape RichText
devX2712 Feb 2, 2021
ecf8e86
ADD Effect managment to Shape,Paragraph and Text
devX2712 Feb 2, 2021
ab1f264
BUGFIX for duplacting slide
devX2712 Feb 3, 2021
106cb76
ADD vertical alos need horz sometimes
devX2712 Feb 3, 2021
c352389
ADD Get more font attributs
devX2712 Feb 3, 2021
cfb4a25
BUGFIX Forgot clone for effect shape
devX2712 Feb 3, 2021
0bb8b00
ADD usefull function te search shape into a slide
devX2712 Feb 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 98 additions & 3 deletions src/PhpPresentation/AbstractShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,26 @@ 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
*
* @var string
*/
private $hashIndex;

/**
* Name
*
* @var string
*/
protected $name;

/**
* Create a new self
*/
Expand All @@ -122,9 +135,11 @@ public function __construct()
$this->width = 0;
$this->height = 0;
$this->rotation = 0;
$this->name = '';
$this->fill = new Style\Fill();
$this->border = new Style\Border();
$this->shadow = new Style\Shadow();
$this->effectCollection = null;

$this->border->setLineStyle(Style\Border::LINE_NONE);
}
Expand All @@ -135,9 +150,27 @@ public function __construct()
public function __clone()
{
$this->container = null;
$this->fill = clone $this->fill;
$this->border = clone $this->border;
$this->shadow = clone $this->shadow;
$this->name = $this->name;
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;
}
if (isset($this->placeholder)) {
$this->placeholder = clone $this->placeholder;
}
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 Down Expand Up @@ -190,6 +223,28 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO
return $this;
}

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

/**
* Set Name
*
* @param string $pValue
* @return \PhpOffice\PhpPresentation\Shape\AbstractGraphic
*/
public function setName($pValue = '')
{
$this->name = $pValue;
return $this;
}

/**
* Get OffsetX
*
Expand Down Expand Up @@ -407,6 +462,46 @@ public function setHyperlink(Hyperlink $pHyperlink = null)
$this->hyperlink = $pHyperlink;
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
63 changes: 62 additions & 1 deletion src/PhpPresentation/DocumentProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,20 @@ class DocumentProperties
* @var string
*/
private $company;


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

/**
* status
*
* @var string
*/
private $status;
/**
* Create a new \PhpOffice\PhpPresentation\DocumentProperties
*/
Expand All @@ -108,6 +121,8 @@ public function __construct()
$this->keywords = '';
$this->category = '';
$this->company = 'Microsoft Corporation';
$this->revision = '';
$this->status = '';
}

/**
Expand Down Expand Up @@ -345,4 +360,50 @@ public function setCompany($pValue = '')

return $this;
}

/**
* Get Revision
*
* @return string
*/
public function getRevision()
{
return $this->revision;
}

/**
* Set Revision
*
* @param string $pValue
* @return \PhpOffice\PhpPresentation\DocumentProperties
*/
public function setRevision($pValue = '')
{
$this->revision = $pValue;

return $this;
}

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

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

return $this;
}
}
57 changes: 52 additions & 5 deletions src/PhpPresentation/PresentationProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class PresentationProperties
const VIEW_SLIDE_MASTER = 'sldMasterView';
const VIEW_SLIDE_SORTER = 'sldSorterView';
const VIEW_SLIDE_THUMBNAIL = 'sldThumbnailView';
const THUMBNAIL_FILE = 'file'; // Thumbnail path is out of PPT
const THUMBNAIL_ZIP = 'zip'; // Thumbnail path point to an image store into file loaded

protected $arrayView = array(
self::VIEW_HANDOUT,
Expand All @@ -53,9 +55,19 @@ class PresentationProperties
protected $markAsFinal = false;

/*
* @var string
* @var string Define the thumbnail content (if content into zip file)
*/
protected $thumbnail = null;

/*
* @var string Define the thumbnail place
*/
protected $thumbnailPath = '';

/*
* @var string Define if thumbnail is out of PPT or previouly store into PPT
*/
protected $thumbnail;
protected $thumbnailType = self::THUMBNAIL_FILE;

/**
* Zoom
Expand Down Expand Up @@ -99,22 +111,57 @@ public function setLoopContinuouslyUntilEsc($value = false)
*/
public function getThumbnailPath()
{
return $this->thumbnailPath;
}

/**
* Return the content of thumbnail
*
* @return binary Content of image
*/
public function getThumbnail()
{
// Return content of local file
if ($this->getThumbnailType() == self::THUMBNAIL_FILE) {
if (file_exists($this->getThumbnailPath()))
return file_get_contents($this->getThumbnailPath());
}
// Return content of image stored into zip file
if ($this->getThumbnailType() == self::THUMBNAIL_ZIP) {
return $this->thumbnail;
}
// Return null if no thumbnail
return null;
}

/**
* Define the path for the thumbnail file / preview picture
* @param string $path
* @return \PhpOffice\PhpPresentation\PresentationProperties
*/
public function setThumbnailPath($path = '')
public function setThumbnailPath($path = '', $type = self::THUMBNAIL_FILE, $content = null)
{
if (file_exists($path)) {
$this->thumbnail = $path;
if (file_exists($path) && ($type == self::THUMBNAIL_FILE)) {
$this->thumbnailPath = $path;
$this->thumbnailType = $type;
}
if (($path != '') && ($type == self::THUMBNAIL_ZIP)) {
$this->thumbnailPath = $path;
$this->thumbnailType = $type;
$this->thumbnail = $content;
}
return $this;
}

/**
* Return the thumbnail type
* @return string
*/
public function getThumbnailType()
{
return $this->thumbnailType;
}

/**
* Mark a document as final
* @param bool $state
Expand Down
Loading