Пример #1
0
 public function testTransitionType()
 {
     $object = new Transition();
     $this->assertNull($object->getTransitionType());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType());
     $this->assertNull($object->getTransitionType());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM));
     $this->assertEquals(Transition::TRANSITION_RANDOM, $object->getTransitionType());
 }
$objPHPPowerPoint->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPowerPoint Team')->setTitle('Sample 10 Title')->setSubject('Sample 10 Subject')->setDescription('Sample 10 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$slide0 = $objPHPPowerPoint->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')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$shapeDrawing->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
$shapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint');
// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shapeRichText = $slide0->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$shapeRichText->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $shapeRichText->createTextRun('Thank you for using PHPPowerPoint!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
$oTransition = new Transition();
$oTransition->setManualTrigger(false);
$oTransition->setTimeTrigger(true, 4000);
$oTransition->setTransitionType(Transition::TRANSITION_SPLIT_IN_VERTICAL);
$slide0->setTransition($oTransition);
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$slide1 = $objPHPPowerPoint->createSlide();
$slide1->addShape(clone $shapeDrawing);
$slide1->addShape(clone $shapeRichText);
// Save file
echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
Пример #3
0
 public function testTransition()
 {
     $value = rand(1000, 5000);
     $oTransition = new Transition();
     $phpPowerPoint = new PhpPowerpoint();
     $oSlide = $phpPowerPoint->getActiveSlide();
     $element = '/p:sld/p:transition';
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
     $this->assertFalse($pres->elementExists($element, 'ppt/slides/slide1.xml'));
     $oTransition->setTimeTrigger(true, $value);
     $oSlide->setTransition($oTransition);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, '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');
     $this->assertContains('fast', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml'));
     $oTransition->setSpeed(Transition::SPEED_MEDIUM);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
     $this->assertContains('med', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml'));
     $oTransition->setSpeed(Transition::SPEED_SLOW);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
     $this->assertContains('slow', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml'));
     $rcTransition = new \ReflectionClass('PhpOffice\\PhpPowerpoint\\Slide\\Transition');
     $arrayConstants = $rcTransition->getConstants();
     foreach ($arrayConstants as $key => $value) {
         if (strpos($key, 'TRANSITION_') !== 0) {
             continue;
         }
         $oTransition->setTransitionType($rcTransition->getConstant($key));
         $oSlide->setTransition($oTransition);
         $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
         switch ($key) {
             case 'TRANSITION_BLINDS_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:blinds[@dir=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_BLINDS_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:blinds[@dir=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_CHECKER_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:checker[@dir=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_CHECKER_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:checker[@dir=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_CIRCLE_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:circle[@dir=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_CIRCLE_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:circle[@dir=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COMB_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:comb[@dir=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COMB_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:comb[@dir=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'d\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'l\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'ld\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'lu\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'r\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'rd\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'ru\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_COVER_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:cover[@dir=\'u\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_CUT':
                 $this->assertTrue($pres->elementExists($element . '/p:cut', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_DIAMOND':
                 $this->assertTrue($pres->elementExists($element . '/p:diamond', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_DISSOLVE':
                 $this->assertTrue($pres->elementExists($element . '/p:dissolve', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_FADE':
                 $this->assertTrue($pres->elementExists($element . '/p:fade', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_NEWSFLASH':
                 $this->assertTrue($pres->elementExists($element . '/p:newsflash', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PLUS':
                 $this->assertTrue($pres->elementExists($element . '/p:plus', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PULL_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:pull[@dir=\'d\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PULL_LEFT':
                 $this->assertTrue($pres->elementExists($element . '/p:pull[@dir=\'l\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PULL_RIGHT':
                 $this->assertTrue($pres->elementExists($element . '/p:pull[@dir=\'r\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PULL_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:pull[@dir=\'u\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PUSH_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:push[@dir=\'d\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PUSH_LEFT':
                 $this->assertTrue($pres->elementExists($element . '/p:push[@dir=\'l\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PUSH_RIGHT':
                 $this->assertTrue($pres->elementExists($element . '/p:push[@dir=\'r\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_PUSH_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:push[@dir=\'u\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_RANDOM':
                 $this->assertTrue($pres->elementExists($element . '/p:random', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_RANDOMBAR_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:randomBar[@dir=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_RANDOMBAR_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:randomBar[@dir=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_SPLIT_IN_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:split[@dir=\'in\'][@orient=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_SPLIT_OUT_HORIZONTAL':
                 $this->assertTrue($pres->elementExists($element . '/p:split[@dir=\'out\'][@orient=\'horz\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_SPLIT_IN_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:split[@dir=\'in\'][@orient=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_SPLIT_OUT_VERTICAL':
                 $this->assertTrue($pres->elementExists($element . '/p:split[@dir=\'out\'][@orient=\'vert\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_STRIPS_LEFT_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:strips[@dir=\'ld\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_STRIPS_LEFT_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:strips[@dir=\'lu\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_STRIPS_RIGHT_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:strips[@dir=\'rd\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_STRIPS_RIGHT_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:strips[@dir=\'ru\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_WEDGE':
                 $this->assertTrue($pres->elementExists($element . '/p:wedge', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_WIPE_DOWN':
                 $this->assertTrue($pres->elementExists($element . '/p:wipe[@dir=\'d\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_WIPE_LEFT':
                 $this->assertTrue($pres->elementExists($element . '/p:wipe[@dir=\'l\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_WIPE_RIGHT':
                 $this->assertTrue($pres->elementExists($element . '/p:wipe[@dir=\'r\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_WIPE_UP':
                 $this->assertTrue($pres->elementExists($element . '/p:wipe[@dir=\'u\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_ZOOM_IN':
                 $this->assertTrue($pres->elementExists($element . '/p:zoom[@dir=\'in\']', 'ppt/slides/slide1.xml'));
                 break;
             case 'TRANSITION_ZOOM_OUT':
                 $this->assertTrue($pres->elementExists($element . '/p:zoom[@dir=\'out\']', 'ppt/slides/slide1.xml'));
                 break;
         }
     }
     $oTransition->setManualTrigger(true);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
     $this->assertContains('1', $pres->getElementAttribute($element, 'advClick', 'ppt/slides/slide1.xml'));
 }
Пример #4
0
 public function testTransition()
 {
     $value = rand(1000, 5000);
     $oTransition = new Transition();
     $phpPowerPoint = new PhpPowerpoint();
     $oSlide = $phpPowerPoint->getActiveSlide();
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePage0\']/style:drawing-page-properties';
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, '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');
     $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'));
     $this->assertStringEndsWith('S', $pres->getElementAttribute($element, 'presentation:duration', 'content.xml'));
     $this->assertContains(number_format($value / 1000, 6, '.', ''), $pres->getElementAttribute($element, 'presentation:duration', 'content.xml'));
     $this->assertContains('automatic', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml'));
     $oTransition->setSpeed(Transition::SPEED_FAST);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $this->assertContains('fast', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml'));
     $oTransition->setSpeed(Transition::SPEED_MEDIUM);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $this->assertContains('medium', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml'));
     $oTransition->setSpeed(Transition::SPEED_SLOW);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $this->assertContains('slow', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml'));
     $rcTransition = new \ReflectionClass('PhpOffice\\PhpPowerpoint\\Slide\\Transition');
     $arrayConstants = $rcTransition->getConstants();
     foreach ($arrayConstants as $key => $value) {
         if (strpos($key, 'TRANSITION_') !== 0) {
             continue;
         }
         $oTransition->setTransitionType($rcTransition->getConstant($key));
         $oSlide->setTransition($oTransition);
         $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
         switch ($key) {
             case 'TRANSITION_BLINDS_HORIZONTAL':
                 $this->assertContains('horizontal-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_BLINDS_VERTICAL':
                 $this->assertContains('vertical-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_CHECKER_HORIZONTAL':
                 $this->assertContains('horizontal-checkerboard', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_CHECKER_VERTICAL':
                 $this->assertContains('vertical-checkerboard', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_CIRCLE_HORIZONTAL':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_CIRCLE_VERTICAL':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COMB_HORIZONTAL':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COMB_VERTICAL':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_DOWN':
                 $this->assertContains('uncover-to-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT':
                 $this->assertContains('uncover-to-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT_DOWN':
                 $this->assertContains('uncover-to-lowerleft', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_LEFT_UP':
                 $this->assertContains('uncover-to-upperleft', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT':
                 $this->assertContains('uncover-to-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT_DOWN':
                 $this->assertContains('uncover-to-lowerright', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_RIGHT_UP':
                 $this->assertContains('uncover-to-upperright', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_COVER_UP':
                 $this->assertContains('uncover-to-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_CUT':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_DIAMOND':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_DISSOLVE':
                 $this->assertContains('dissolve', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_FADE':
                 $this->assertContains('fade-from-center', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_NEWSFLASH':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PLUS':
                 $this->assertContains('close', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PULL_DOWN':
                 $this->assertContains('stretch-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PULL_LEFT':
                 $this->assertContains('stretch-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PULL_RIGHT':
                 $this->assertContains('stretch-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PULL_UP':
                 $this->assertContains('stretch-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PUSH_DOWN':
                 $this->assertContains('roll-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PUSH_LEFT':
                 $this->assertContains('roll-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PUSH_RIGHT':
                 $this->assertContains('roll-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_PUSH_UP':
                 $this->assertContains('roll-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_RANDOM':
                 $this->assertContains('random', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_RANDOMBAR_HORIZONTAL':
                 $this->assertContains('horizontal-lines', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_RANDOMBAR_VERTICAL':
                 $this->assertContains('vertical-lines', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_SPLIT_IN_HORIZONTAL':
                 $this->assertContains('close-horizontal', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_SPLIT_OUT_HORIZONTAL':
                 $this->assertContains('open-horizontal', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_SPLIT_IN_VERTICAL':
                 $this->assertContains('close-vertical', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_SPLIT_OUT_VERTICAL':
                 $this->assertContains('open-vertical', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_STRIPS_LEFT_DOWN':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_STRIPS_LEFT_UP':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_STRIPS_RIGHT_DOWN':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_STRIPS_RIGHT_UP':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_WEDGE':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_WIPE_DOWN':
                 $this->assertContains('fade-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_WIPE_LEFT':
                 $this->assertContains('fade-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_WIPE_RIGHT':
                 $this->assertContains('fade-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_WIPE_UP':
                 $this->assertContains('fade-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_ZOOM_IN':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
             case 'TRANSITION_ZOOM_OUT':
                 $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml'));
                 break;
         }
     }
     $oTransition->setManualTrigger(true);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $this->assertContains('manual', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml'));
 }
Пример #5
0
 /**
  * Write Transition Slide
  * @link http://officeopenxml.com/prSlide-transitions.php
  * @param XMLWriter $objWriter
  * @param Transition $transition
  */
 public function writeTransition(XMLWriter $objWriter, Transition $transition)
 {
     $objWriter->startElement('p:transition');
     if (!is_null($transition->getSpeed())) {
         $objWriter->writeAttribute('spd', $transition->getSpeed());
     }
     $objWriter->writeAttribute('advClick', $transition->hasManualTrigger() ? '1' : '0');
     if ($transition->hasTimeTrigger()) {
         $objWriter->writeAttribute('advTm', $transition->getAdvanceTimeTrigger());
     }
     switch ($transition->getTransitionType()) {
         case Transition::TRANSITION_BLINDS_HORIZONTAL:
             $objWriter->startElement('p:blinds');
             $objWriter->writeAttribute('dir', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_BLINDS_VERTICAL:
             $objWriter->startElement('p:blinds');
             $objWriter->writeAttribute('dir', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_CHECKER_HORIZONTAL:
             $objWriter->startElement('p:checker');
             $objWriter->writeAttribute('dir', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_CHECKER_VERTICAL:
             $objWriter->startElement('p:checker');
             $objWriter->writeAttribute('dir', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_CIRCLE_HORIZONTAL:
             $objWriter->startElement('p:circle');
             $objWriter->writeAttribute('dir', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_CIRCLE_VERTICAL:
             $objWriter->startElement('p:circle');
             $objWriter->writeAttribute('dir', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COMB_HORIZONTAL:
             $objWriter->startElement('p:comb');
             $objWriter->writeAttribute('dir', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COMB_VERTICAL:
             $objWriter->startElement('p:comb');
             $objWriter->writeAttribute('dir', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_DOWN:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_LEFT:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'l');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_LEFT_DOWN:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'ld');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_LEFT_UP:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'lu');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_RIGHT:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'r');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_RIGHT_DOWN:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'rd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_RIGHT_UP:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'ru');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_COVER_UP:
             $objWriter->startElement('p:cover');
             $objWriter->writeAttribute('dir', 'u');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_CUT:
             $objWriter->writeElement('p:cut');
             break;
         case Transition::TRANSITION_DIAMOND:
             $objWriter->writeElement('p:diamond');
             break;
         case Transition::TRANSITION_DISSOLVE:
             $objWriter->writeElement('p:dissolve');
             break;
         case Transition::TRANSITION_FADE:
             $objWriter->writeElement('p:fade');
             break;
         case Transition::TRANSITION_NEWSFLASH:
             $objWriter->writeElement('p:newsflash');
             break;
         case Transition::TRANSITION_PLUS:
             $objWriter->writeElement('p:plus');
             break;
         case Transition::TRANSITION_PULL_DOWN:
             $objWriter->startElement('p:pull');
             $objWriter->writeAttribute('dir', 'd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PULL_LEFT:
             $objWriter->startElement('p:pull');
             $objWriter->writeAttribute('dir', 'l');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PULL_RIGHT:
             $objWriter->startElement('p:pull');
             $objWriter->writeAttribute('dir', 'r');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PULL_UP:
             $objWriter->startElement('p:pull');
             $objWriter->writeAttribute('dir', 'u');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PUSH_DOWN:
             $objWriter->startElement('p:push');
             $objWriter->writeAttribute('dir', 'd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PUSH_LEFT:
             $objWriter->startElement('p:push');
             $objWriter->writeAttribute('dir', 'l');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PUSH_RIGHT:
             $objWriter->startElement('p:push');
             $objWriter->writeAttribute('dir', 'r');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_PUSH_UP:
             $objWriter->startElement('p:push');
             $objWriter->writeAttribute('dir', 'u');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_RANDOM:
             $objWriter->writeElement('p:random');
             break;
         case Transition::TRANSITION_RANDOMBAR_HORIZONTAL:
             $objWriter->startElement('p:randomBar');
             $objWriter->writeAttribute('dir', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_RANDOMBAR_VERTICAL:
             $objWriter->startElement('p:randomBar');
             $objWriter->writeAttribute('dir', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_SPLIT_IN_HORIZONTAL:
             $objWriter->startElement('p:split');
             $objWriter->writeAttribute('dir', 'in');
             $objWriter->writeAttribute('orient', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL:
             $objWriter->startElement('p:split');
             $objWriter->writeAttribute('dir', 'out');
             $objWriter->writeAttribute('orient', 'horz');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_SPLIT_IN_VERTICAL:
             $objWriter->startElement('p:split');
             $objWriter->writeAttribute('dir', 'in');
             $objWriter->writeAttribute('orient', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_SPLIT_OUT_VERTICAL:
             $objWriter->startElement('p:split');
             $objWriter->writeAttribute('dir', 'out');
             $objWriter->writeAttribute('orient', 'vert');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_STRIPS_LEFT_DOWN:
             $objWriter->startElement('p:strips');
             $objWriter->writeAttribute('dir', 'ld');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_STRIPS_LEFT_UP:
             $objWriter->startElement('p:strips');
             $objWriter->writeAttribute('dir', 'lu');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_STRIPS_RIGHT_DOWN:
             $objWriter->startElement('p:strips');
             $objWriter->writeAttribute('dir', 'rd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_STRIPS_RIGHT_UP:
             $objWriter->startElement('p:strips');
             $objWriter->writeAttribute('dir', 'ru');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_WEDGE:
             $objWriter->writeElement('p:wedge');
             break;
         case Transition::TRANSITION_WIPE_DOWN:
             $objWriter->startElement('p:wipe');
             $objWriter->writeAttribute('dir', 'd');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_WIPE_LEFT:
             $objWriter->startElement('p:wipe');
             $objWriter->writeAttribute('dir', 'l');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_WIPE_RIGHT:
             $objWriter->startElement('p:wipe');
             $objWriter->writeAttribute('dir', 'r');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_WIPE_UP:
             $objWriter->startElement('p:wipe');
             $objWriter->writeAttribute('dir', 'u');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_ZOOM_IN:
             $objWriter->startElement('p:zoom');
             $objWriter->writeAttribute('dir', 'in');
             $objWriter->endElement();
             break;
         case Transition::TRANSITION_ZOOM_OUT:
             $objWriter->startElement('p:zoom');
             $objWriter->writeAttribute('dir', 'out');
             $objWriter->endElement();
             break;
     }
     $objWriter->endElement();
 }