Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PptPresProps
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 render
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4 * presentations documents.
5 *
6 * PHPPresentation is free software distributed under the terms of the GNU Lesser
7 * General Public License version 3 as published by the Free Software Foundation.
8 *
9 * For the full copyright and license information, please read the LICENSE
10 * file that was distributed with this source code. For the full list of
11 * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12 *
13 * @see        https://github.com/PHPOffice/PHPPresentation
14 *
15 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16 */
17
18declare(strict_types=1);
19
20namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007;
21
22use PhpOffice\Common\Adapter\Zip\ZipInterface;
23use PhpOffice\Common\XMLWriter;
24
25class PptPresProps extends AbstractDecoratorWriter
26{
27    public function render(): ZipInterface
28    {
29        $presentationPpts = $this->oPresentation->getPresentationProperties();
30
31        // Create XML writer
32        $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
33
34        // XML header
35        $objWriter->startDocument('1.0', 'UTF-8', 'yes');
36
37        // p:presentationPr
38        $objWriter->startElement('p:presentationPr');
39        $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
40        $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
41        $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
42
43        // p:presentationPr > p:showPr
44        $objWriter->startElement('p:showPr');
45        if ($presentationPpts->isLoopContinuouslyUntilEsc()) {
46            $objWriter->writeAttribute('loop', '1');
47        }
48        // Depends on the slideshow type
49        // p:presentationPr > p:showPr > p:present
50        // p:presentationPr > p:showPr > p:browse
51        // p:presentationPr > p:showPr > p:kiosk
52        $objWriter->writeElement('p:' . $presentationPpts->getSlideshowType());
53
54        // > p:presentationPr > p:showPr
55        $objWriter->endElement();
56
57        // p:extLst
58        $objWriter->startElement('p:extLst');
59
60        // p:ext
61        $objWriter->startElement('p:ext');
62        $objWriter->writeAttribute('uri', '{E76CE94A-603C-4142-B9EB-6D1370010A27}');
63
64        // p14:discardImageEditData
65        $objWriter->startElement('p14:discardImageEditData');
66        $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
67        $objWriter->writeAttribute('val', '0');
68        $objWriter->endElement();
69
70        // > p:ext
71        $objWriter->endElement();
72
73        // p:ext
74        $objWriter->startElement('p:ext');
75        $objWriter->writeAttribute('uri', '{D31A062A-798A-4329-ABDD-BBA856620510}');
76
77        // p14:defaultImageDpi
78        $objWriter->startElement('p14:defaultImageDpi');
79        $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
80        $objWriter->writeAttribute('val', '220');
81        $objWriter->endElement();
82
83        // > p:ext
84        $objWriter->endElement();
85        // > p:extLst
86        $objWriter->endElement();
87        // > p:presentationPr
88        $objWriter->endElement();
89
90        $this->getZip()->addFromString('ppt/presProps.xml', $objWriter->getData());
91
92        return $this->getZip();
93    }
94}