/** * Write the default style information for a RichText shape * * @param \PhpOffice\Common\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape */ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) { // style:style $objWriter->startElement('style:style'); $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); $objWriter->writeAttribute('style:family', 'graphic'); $objWriter->writeAttribute('style:parent-style-name', 'standard'); // style:graphic-properties $objWriter->startElement('style:graphic-properties'); if ($shape->getShadow()->isVisible()) { $this->writeStylePartShadow($objWriter, $shape->getShadow()); } if (is_bool($shape->hasAutoShrinkVertical())) { $objWriter->writeAttribute('draw:auto-grow-height', var_export($shape->hasAutoShrinkVertical(), true)); } if (is_bool($shape->hasAutoShrinkHorizontal())) { $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); } // Fill switch ($shape->getFill()->getFillType()) { case Fill::FILL_GRADIENT_LINEAR: case Fill::FILL_GRADIENT_PATH: $objWriter->writeAttribute('draw:fill', 'gradient'); $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_' . $shape->getFill()->getHashCode()); break; case Fill::FILL_SOLID: $objWriter->writeAttribute('draw:fill', 'solid'); $objWriter->writeAttribute('draw:fill-color', '#' . $shape->getFill()->getStartColor()->getRGB()); break; case Fill::FILL_NONE: default: $objWriter->writeAttribute('draw:fill', 'none'); $objWriter->writeAttribute('draw:fill-color', '#' . $shape->getFill()->getStartColor()->getRGB()); break; } // Border if ($shape->getBorder()->getLineStyle() == Border::LINE_NONE) { $objWriter->writeAttribute('draw:stroke', 'none'); } else { $objWriter->writeAttribute('svg:stroke-color', '#' . $shape->getBorder()->getColor()->getRGB()); $objWriter->writeAttribute('svg:stroke-width', number_format(CommonDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '') . 'cm'); switch ($shape->getBorder()->getDashStyle()) { case Border::DASH_SOLID: $objWriter->writeAttribute('draw:stroke', 'solid'); break; case Border::DASH_DASH: case Border::DASH_DASHDOT: case Border::DASH_DOT: case Border::DASH_LARGEDASH: case Border::DASH_LARGEDASHDOT: case Border::DASH_LARGEDASHDOTDOT: case Border::DASH_SYSDASH: case Border::DASH_SYSDASHDOT: case Border::DASH_SYSDASHDOTDOT: case Border::DASH_SYSDOT: $objWriter->writeAttribute('draw:stroke', 'dash'); $objWriter->writeAttribute('draw:stroke-dash', 'strokeDash_' . $shape->getBorder()->getDashStyle()); break; default: $objWriter->writeAttribute('draw:stroke', 'none'); break; } } $objWriter->writeAttribute('fo:wrap-option', 'wrap'); // > style:graphic-properties $objWriter->endElement(); // > style:style $objWriter->endElement(); $paragraphs = $shape->getParagraphs(); $paragraphId = 0; foreach ($paragraphs as $paragraph) { ++$paragraphId; // Style des paragraphes if (!isset($this->arrStyleParagraph[$paragraph->getHashCode()])) { $this->arrStyleParagraph[$paragraph->getHashCode()] = $paragraph; } // Style des listes if (!isset($this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()])) { $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oStyle'] = $paragraph->getBulletStyle(); $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] = ''; } if (strpos($this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'], ';' . $paragraph->getAlignment()->getLevel()) === false) { $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] .= ';' . $paragraph->getAlignment()->getLevel(); $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oAlign_' . $paragraph->getAlignment()->getLevel()] = $paragraph->getAlignment(); } $richtexts = $paragraph->getRichTextElements(); $richtextId = 0; foreach ($richtexts as $richtext) { ++$richtextId; // Not a line break if ($richtext instanceof Run) { // Style des font text if (!isset($this->arrStyleTextFont[$richtext->getFont()->getHashCode()])) { $this->arrStyleTextFont[$richtext->getFont()->getHashCode()] = $richtext->getFont(); } } } } }
/** * Write text * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape * @param int $shapeId */ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape, $shapeId) { // draw:frame $objWriter->startElement('draw:frame'); $objWriter->writeAttribute('draw:style-name', 'gr' . $shapeId); $objWriter->writeAttribute('svg:width', StringHelper::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); $objWriter->writeAttribute('svg:height', StringHelper::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); $objWriter->writeAttribute('svg:x', StringHelper::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); $objWriter->writeAttribute('svg:y', StringHelper::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); // draw:text-box $objWriter->startElement('draw:text-box'); $paragraphs = $shape->getParagraphs(); $paragraphId = 0; $sCstShpLastBullet = ''; $iCstShpLastBulletLvl = 0; $bCstShpHasBullet = false; foreach ($paragraphs as $paragraph) { // Close the bullet list if ($sCstShpLastBullet != 'bullet' && $bCstShpHasBullet == true) { for ($iInc = $iCstShpLastBulletLvl; $iInc >= 0; $iInc--) { // text:list-item $objWriter->endElement(); // text:list $objWriter->endElement(); } } //=============================================== // Paragraph //=============================================== if ($paragraph->getBulletStyle()->getBulletType() == 'none') { ++$paragraphId; // text:p $objWriter->startElement('text:p'); $objWriter->writeAttribute('text:style-name', 'P_' . $paragraph->getHashCode()); // Loop trough rich text elements $richtexts = $paragraph->getRichTextElements(); $richtextId = 0; foreach ($richtexts as $richtext) { ++$richtextId; if ($richtext instanceof TextElement || $richtext instanceof Run) { // text:span $objWriter->startElement('text:span'); if ($richtext instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $richtext->getFont()->getHashCode()); } if ($richtext->hasHyperlink() == true && $richtext->getHyperlink()->getUrl() != '') { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $richtext->getHyperlink()->getUrl()); $objWriter->text($richtext->getText()); $objWriter->endElement(); } else { $objWriter->text($richtext->getText()); } $objWriter->endElement(); } elseif ($richtext instanceof BreakElement) { // text:span $objWriter->startElement('text:span'); // text:line-break $objWriter->startElement('text:line-break'); $objWriter->endElement(); $objWriter->endElement(); } else { //echo '<pre>'.print_r($richtext, true).'</pre>'; } } $objWriter->endElement(); //=============================================== // Bullet list //=============================================== } elseif ($paragraph->getBulletStyle()->getBulletType() == 'bullet') { $bCstShpHasBullet = true; // Open the bullet list if ($sCstShpLastBullet != 'bullet' || $sCstShpLastBullet == $paragraph->getBulletStyle()->getBulletType() && $iCstShpLastBulletLvl < $paragraph->getAlignment()->getLevel()) { // text:list $objWriter->startElement('text:list'); $objWriter->writeAttribute('text:style-name', 'L_' . $paragraph->getBulletStyle()->getHashCode()); } if ($sCstShpLastBullet == 'bullet') { if ($iCstShpLastBulletLvl == $paragraph->getAlignment()->getLevel()) { // text:list-item $objWriter->endElement(); } elseif ($iCstShpLastBulletLvl > $paragraph->getAlignment()->getLevel()) { // text:list-item $objWriter->endElement(); // text:list $objWriter->endElement(); // text:list-item $objWriter->endElement(); } } // text:list-item $objWriter->startElement('text:list-item'); ++$paragraphId; // text:p $objWriter->startElement('text:p'); $objWriter->writeAttribute('text:style-name', 'P_' . $paragraph->getHashCode()); // Loop trough rich text elements $richtexts = $paragraph->getRichTextElements(); $richtextId = 0; foreach ($richtexts as $richtext) { ++$richtextId; if ($richtext instanceof TextElement || $richtext instanceof Run) { // text:span $objWriter->startElement('text:span'); if ($richtext instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $richtext->getFont()->getHashCode()); } if ($richtext->hasHyperlink() == true && $richtext->getHyperlink()->getUrl() != '') { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $richtext->getHyperlink()->getUrl()); $objWriter->text($richtext->getText()); $objWriter->endElement(); } else { $objWriter->text($richtext->getText()); } $objWriter->endElement(); } elseif ($richtext instanceof BreakElement) { // text:span $objWriter->startElement('text:span'); // text:line-break $objWriter->startElement('text:line-break'); $objWriter->endElement(); $objWriter->endElement(); } else { //echo '<pre>'.print_r($richtext, true).'</pre>'; } } $objWriter->endElement(); } $sCstShpLastBullet = $paragraph->getBulletStyle()->getBulletType(); $iCstShpLastBulletLvl = $paragraph->getAlignment()->getLevel(); } // Close the bullet list if ($sCstShpLastBullet == 'bullet' && $bCstShpHasBullet == true) { for ($iInc = $iCstShpLastBulletLvl; $iInc >= 0; $iInc--) { // text:list-item $objWriter->endElement(); // text:list $objWriter->endElement(); } } // > draw:text-box $objWriter->endElement(); // > draw:frame $objWriter->endElement(); }
/** * Write txt * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape * @param int $shapeId * @throws \Exception */ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) { // p:sp $objWriter->startElement('p:sp'); // p:nvSpPr $objWriter->startElement('p:nvSpPr'); // p:cNvPr $objWriter->startElement('p:cNvPr'); $objWriter->writeAttribute('id', $shapeId); $objWriter->writeAttribute('name', ''); $objWriter->endElement(); // p:cNvSpPr $objWriter->startElement('p:cNvSpPr'); $objWriter->writeAttribute('txBox', '1'); $objWriter->endElement(); // p:nvPr $objWriter->writeElement('p:nvPr', null); $objWriter->endElement(); // p:spPr $objWriter->startElement('p:spPr'); // a:xfrm $objWriter->startElement('a:xfrm'); $objWriter->writeAttribute('rot', SharedDrawing::degreesToAngle($shape->getRotation())); // a:off $objWriter->startElement('a:off'); $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); $objWriter->endElement(); // a:prstGeom $objWriter->startElement('a:prstGeom'); $objWriter->writeAttribute('prst', 'rect'); $objWriter->endElement(); $objWriter->endElement(); // p:txBody $objWriter->startElement('p:txBody'); // a:bodyPr $objWriter->startElement('a:bodyPr'); $objWriter->writeAttribute('anchor', $shape->getActiveParagraph()->getAlignment()->getVertical()); $objWriter->writeAttribute('wrap', $shape->getWrap()); $objWriter->writeAttribute('rtlCol', '0'); $objWriter->writeAttribute('horzOverflow', $shape->getHorizontalOverflow()); $objWriter->writeAttribute('vertOverflow', $shape->getVerticalOverflow()); if ($shape->isUpright()) { $objWriter->writeAttribute('upright', '1'); } if ($shape->isVertical()) { $objWriter->writeAttribute('vert', 'vert'); } $objWriter->writeAttribute('bIns', SharedDrawing::pixelsToEmu($shape->getInsetBottom())); $objWriter->writeAttribute('lIns', SharedDrawing::pixelsToEmu($shape->getInsetLeft())); $objWriter->writeAttribute('rIns', SharedDrawing::pixelsToEmu($shape->getInsetRight())); $objWriter->writeAttribute('tIns', SharedDrawing::pixelsToEmu($shape->getInsetTop())); $objWriter->writeAttribute('numCol', $shape->getColumns()); // a:spAutoFit $objWriter->writeElement('a:' . $shape->getAutoFit(), null); $objWriter->endElement(); // a:lstStyle $objWriter->writeElement('a:lstStyle', null); // Write paragraphs $this->writeParagraphs($objWriter, $shape->getParagraphs()); $objWriter->endElement(); $objWriter->endElement(); }
public function testWidthAndHeight() { $object = new RichText(); $value = rand(1, 100); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight()); $this->assertEquals(0, $object->getWidth()); $this->assertEquals(0, $object->getHeight()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight($value)); $this->assertEquals($value, $object->getWidth()); $this->assertEquals(0, $object->getHeight()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\AbstractShape', $object->setWidthAndHeight($value, $value)); $this->assertEquals($value, $object->getWidth()); $this->assertEquals($value, $object->getHeight()); }
/** * Write txt * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape * @param int $shapeId * @throws \Exception */ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) { // p:sp $objWriter->startElement('p:sp'); // p:sp\p:nvSpPr $objWriter->startElement('p:nvSpPr'); // p:sp\p:nvSpPr\p:cNvPr $objWriter->startElement('p:cNvPr'); $objWriter->writeAttribute('id', $shapeId); $objWriter->writeAttribute('name', ''); // Hyperlink if ($shape->hasHyperlink()) { $this->writeHyperlink($objWriter, $shape); } // > p:sp\p:nvSpPr $objWriter->endElement(); // p:sp\p:cNvSpPr $objWriter->startElement('p:cNvSpPr'); $objWriter->writeAttribute('txBox', '1'); $objWriter->endElement(); // p:sp\p:cNvSpPr\p:nvPr $objWriter->writeElement('p:nvPr', null); // > p:sp\p:cNvSpPr $objWriter->endElement(); // p:sp\p:spPr $objWriter->startElement('p:spPr'); // p:sp\p:spPr\a:xfrm $objWriter->startElement('a:xfrm'); $objWriter->writeAttribute('rot', CommonDrawing::degreesToAngle($shape->getRotation())); // p:sp\p:spPr\a:xfrm\a:off $objWriter->startElement('a:off'); $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // p:sp\p:spPr\a:xfrm\a:ext $objWriter->startElement('a:ext'); $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); // > p:sp\p:spPr\a:xfrm $objWriter->endElement(); // p:sp\p:spPr\a:prstGeom $objWriter->startElement('a:prstGeom'); $objWriter->writeAttribute('prst', 'rect'); $objWriter->endElement(); if ($shape->getFill()) { $this->writeFill($objWriter, $shape->getFill()); } if ($shape->getBorder()->getLineStyle() != Border::LINE_NONE) { $this->writeBorder($objWriter, $shape->getBorder(), ''); } if ($shape->getShadow()->isVisible()) { $this->writeShadow($objWriter, $shape->getShadow()); } // > p:sp\p:spPr $objWriter->endElement(); // p:txBody $objWriter->startElement('p:txBody'); // a:bodyPr //@link :http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.bodyproperties%28v=office.14%29.aspx $objWriter->startElement('a:bodyPr'); $verticalAlign = $shape->getActiveParagraph()->getAlignment()->getVertical(); if ($verticalAlign != Alignment::VERTICAL_BASE && $verticalAlign != Alignment::VERTICAL_AUTO) { $objWriter->writeAttribute('anchor', $verticalAlign); } if ($shape->getWrap() != RichText::WRAP_SQUARE) { $objWriter->writeAttribute('wrap', $shape->getWrap()); } $objWriter->writeAttribute('rtlCol', '0'); if ($shape->getHorizontalOverflow() != RichText::OVERFLOW_OVERFLOW) { $objWriter->writeAttribute('horzOverflow', $shape->getHorizontalOverflow()); } if ($shape->getVerticalOverflow() != RichText::OVERFLOW_OVERFLOW) { $objWriter->writeAttribute('vertOverflow', $shape->getVerticalOverflow()); } if ($shape->isUpright()) { $objWriter->writeAttribute('upright', '1'); } if ($shape->isVertical()) { $objWriter->writeAttribute('vert', 'vert'); } $objWriter->writeAttribute('bIns', CommonDrawing::pixelsToEmu($shape->getInsetBottom())); $objWriter->writeAttribute('lIns', CommonDrawing::pixelsToEmu($shape->getInsetLeft())); $objWriter->writeAttribute('rIns', CommonDrawing::pixelsToEmu($shape->getInsetRight())); $objWriter->writeAttribute('tIns', CommonDrawing::pixelsToEmu($shape->getInsetTop())); if ($shape->getColumns() != 1) { $objWriter->writeAttribute('numCol', $shape->getColumns()); } // a:spAutoFit $objWriter->startElement('a:' . $shape->getAutoFit()); if ($shape->getAutoFit() == RichText::AUTOFIT_NORMAL) { if (!is_null($shape->getFontScale())) { $objWriter->writeAttribute('fontScale', (int) ($shape->getFontScale() * 1000)); } if (!is_null($shape->getLineSpaceReduction())) { $objWriter->writeAttribute('lnSpcReduction', (int) ($shape->getLineSpaceReduction() * 1000)); } } $objWriter->endElement(); $objWriter->endElement(); // a:lstStyle $objWriter->writeElement('a:lstStyle', null); // Write paragraphs $this->writeParagraphs($objWriter, $shape->getParagraphs()); $objWriter->endElement(); $objWriter->endElement(); }
public function testHashCode() { $object = new RichText(); $hash = $object->getActiveParagraph()->getHashCode(); $hash .= RichText::WRAP_SQUARE . RichText::AUTOFIT_DEFAULT . RichText::OVERFLOW_OVERFLOW . RichText::OVERFLOW_OVERFLOW . '0014.89.69.64.8'; $hash .= md5('00000' . $object->getFill()->getHashCode() . $object->getShadow()->getHashCode() . '' . get_parent_class($object)); $hash .= get_class($object); $this->assertEquals(md5($hash), $object->getHashCode()); }
/** * Write the default style information for a RichText shape * * @param XMLWriter $objWriter * @param RichText $shape */ public function writeRichTextStyle(XMLWriter $objWriter, RichText $shape) { if ($shape->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR || $shape->getFill()->getFillType() == Fill::FILL_GRADIENT_PATH) { if (!in_array($shape->getFill()->getHashCode(), $this->arrayGradient)) { $this->writeGradientFill($objWriter, $shape->getFill()); } } if ($shape->getBorder()->getDashStyle() != Border::DASH_SOLID) { if (!in_array($shape->getBorder()->getDashStyle(), $this->arrayStrokeDash)) { $objWriter->startElement('draw:stroke-dash'); $objWriter->writeAttribute('draw:name', 'strokeDash_' . $shape->getBorder()->getDashStyle()); $objWriter->writeAttribute('draw:style', 'rect'); switch ($shape->getBorder()->getDashStyle()) { case Border::DASH_DASH: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); break; case Border::DASH_DASHDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); break; case Border::DASH_DOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); break; case Border::DASH_LARGEDASH: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); break; case Border::DASH_LARGEDASHDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); break; case Border::DASH_LARGEDASHDOTDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots1', '2'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); break; case Border::DASH_SYSDASH: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); break; case Border::DASH_SYSDASHDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); break; case Border::DASH_SYSDASHDOTDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots1', '2'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); break; case Border::DASH_SYSDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); break; } $objWriter->endElement(); $this->arrayStrokeDash[] = $shape->getBorder()->getDashStyle(); } } }
/** * SlideContainer * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx * @param int $pos */ private function readRTSlide($pos) { $oSlide = $this->oPhpPowerpoint->createSlide(); // echo '@slide'.EOL; // *** slideAtom (32 bytes) // slideAtom > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0x2 || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != self::RT_SLIDEATOM) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > RecordHeader).'); } // slideAtom > geom $pos += 4; // slideAtom > rgPlaceholderTypes $rgPlaceholderTypes = array(); for ($inc = 0; $inc < 8; $inc++) { $rgPlaceholderTypes[] = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; } // slideAtom > masterIdRef $pos += 4; // slideAtom > notesIdRef $pos += 4; // slideAtom > slideFlags $pos += 2; // slideAtom > unused; $pos += 2; // *** slideShowSlideInfoAtom (24 bytes) $pos += 24; // perSlideHFContainer (variable) // perSlideHFContainer > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0xf || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != self::RT_HEADERSFOOTERS) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > perSlideHFContainer > RT_HeadersFooters).'); } $pos += $rHeader['recLen']; // *** rtSlideSyncInfo12 (variable) // *** drawing (variable) // drawing > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0xf || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != self::RT_DRAWING) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > rh).'); } // print_r('@PPDrawing'.EOL); // drawing > OfficeArtDg // drawing > OfficeArtDg > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0xf || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != 0xf002) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > rh).'); } // drawing > OfficeArtDg > drawingData // drawing > OfficeArtDg > drawingData > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] >= 0xffe || $rHeader['recType'] != 0xf008 || $rHeader['recLen'] != 0x8) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > drawingData > rh).'); } // drawing > OfficeArtDg > drawingData > csp $pos += 4; // drawing > OfficeArtDg > drawingData > spidCur $pos += 4; // drawing > OfficeArtDg > groupShape // drawing > OfficeArtDg > groupShape > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0xf || $rHeader['recInstance'] >= 0xf000 || $rHeader['recType'] != 0xf003) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rh).'); } // drawing > OfficeArtDg > groupShape > rgfb do { $shape = null; $arrShpPrimaryOpt = array(); $arrClientAnchor = array(); $arrClientTextBox = array(); $arrClientTextBox['hyperlink'] = array(); $arrClientTextBox['text'] = ''; $arrClientTextBox['numParts'] = 0; $arrClientTextBox['numTexts'] = 0; $rhFB = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; // print_r(EOL); // print_r($rhFB); // print_r(EOL); if ($rhFB['recVer'] != 0xf || $rhFB['recInstance'] != 0x0 || $rhFB['recType'] != 0xf003 && $rhFB['recType'] != 0xf004) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rgfb).'); } switch ($rhFB['recType']) { case 0xf003: // OfficeArtSpgrContainer // OfficeArtSpgrContainer // print_r('@OfficeArtSpgrContainer'.EOL); break; case 0xf004: // OfficeArtSpContainer // shapeGroup $shapeGroup = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($shapeGroup['recVer'] == 0x1 && $shapeGroup['recInstance'] == 0x0 && $shapeGroup['recType'] == 0xf009 && $shapeGroup['recLen'] == 0x10) { // print_r('$shapeGroup'.EOL); $pos += 8; $rHeader['recLen'] -= 8; $arrShapeGroup['xLeft'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $arrShapeGroup['yTop'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $arrShapeGroup['xRight'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; } // shapeProp $shapeProp = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($shapeProp['recVer'] == 0x2 && $shapeProp['recType'] == 0xf00a && $shapeProp['recLen'] == 0x8) { $pos += 8; $rHeader['recLen'] -= 8; // print_r('$shapeProp'.EOL); // spid $pos += 4; $rHeader['recLen'] -= 4; // data $pos += 4; $rHeader['recLen'] -= 4; } // shapePrimaryOptions $shapePrimaryOptions = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($shapePrimaryOptions['recVer'] == 0x3 && $shapePrimaryOptions['recType'] == 0xf00b) { $pos += 8; $rHeader['recLen'] -= 8; // print_r('$shapePrimaryOptions'.EOL); //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx $officeArtFOPTE = array(); for ($inc = 0; $inc < $shapePrimaryOptions['recInstance']; $inc++) { $opid = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $shapePrimaryOptions['recLen'] -= 2; $optOp = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $shapePrimaryOptions['recLen'] -= 4; $officeArtFOPTE[] = array('opid' => $opid >> 0 & bindec('11111111111111'), 'fBid' => $opid >> 14 & bindec('1'), 'fComplex' => $opid >> 15 & bindec('1'), 'op' => $optOp); } //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID foreach ($officeArtFOPTE as $opt) { switch ($opt['opid']) { case 0x7f: // Transform : Protection Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd909131(v=office.12).aspx break; case 0x80: // Text : ltxid //@link : http://msdn.microsoft.com/en-us/library/dd947446(v=office.12).aspx break; case 0x81: // Text : dxTextLeft //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx $arrShpPrimaryOpt['insetLeft'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x82: // Text : dyTextTop //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx $arrShpPrimaryOpt['insetTop'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x83: // Text : dxTextRight //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx $arrShpPrimaryOpt['insetRight'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x84: // Text : dyTextBottom //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx $arrShpPrimaryOpt['insetBottom'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x85: // Text : WrapText //@link : http://msdn.microsoft.com/en-us/library/dd924770(v=office.12).aspx break; case 0x87: // Text : anchorText //@link : http://msdn.microsoft.com/en-us/library/dd948575(v=office.12).aspx break; case 0xbf: // Text : Text Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd950905(v=office.12).aspx break; case 0x104: // Blip : pib //@link : http://msdn.microsoft.com/en-us/library/dd772837(v=office.12).aspx if ($opt['fComplex'] == 0) { $arrShpPrimaryOpt['pib'] = $opt['op']; } else { // pib Complex } break; case 0x140: // Geometry : geoLeft //@link : http://msdn.microsoft.com/en-us/library/dd947489(v=office.12).aspx // print_r('geoLeft : '.$opt['op'].EOL); break; case 0x141: // Geometry : geoTop //@link : http://msdn.microsoft.com/en-us/library/dd949459(v=office.12).aspx // print_r('geoTop : '.$opt['op'].EOL); break; case 0x142: // Geometry : geoRight //@link : http://msdn.microsoft.com/en-us/library/dd947117(v=office.12).aspx // print_r('geoRight : '.$opt['op'].EOL); break; case 0x143: // Geometry : geoBottom //@link : http://msdn.microsoft.com/en-us/library/dd948602(v=office.12).aspx // print_r('geoBottom : '.$opt['op'].EOL); break; case 0x144: // Geometry : shapePath //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx $arrShpPrimaryOpt['line'] = true; break; case 0x145: // Geometry : pVertices //@link : http://msdn.microsoft.com/en-us/library/dd949814(v=office.12).aspx if ($opt['fComplex'] == 1) { $pos += $opt['op']; $rHeader['recLen'] -= $opt['op']; $shapePrimaryOptions['recLen'] -= $opt['op']; } break; case 0x146: // Geometry : pSegmentInfo //@link : http://msdn.microsoft.com/en-us/library/dd905742(v=office.12).aspx if ($opt['fComplex'] == 1) { $pos += $opt['op']; $rHeader['recLen'] -= $opt['op']; $shapePrimaryOptions['recLen'] -= $opt['op']; } break; case 0x155: // Geometry : pAdjustHandles //@link : http://msdn.microsoft.com/en-us/library/dd905890(v=office.12).aspx if ($opt['fComplex'] == 1) { $pos += $opt['op']; $rHeader['recLen'] -= $opt['op']; $shapePrimaryOptions['recLen'] -= $opt['op']; } break; case 0x156: // Geometry : pGuides //@link : http://msdn.microsoft.com/en-us/library/dd910801(v=office.12).aspx if ($opt['fComplex'] == 1) { $pos += $opt['op']; $rHeader['recLen'] -= $opt['op']; $shapePrimaryOptions['recLen'] -= $opt['op']; } break; case 0x157: // Geometry : pInscribe //@link : http://msdn.microsoft.com/en-us/library/dd904889(v=office.12).aspx if ($opt['fComplex'] == 1) { $pos += $opt['op']; $rHeader['recLen'] -= $opt['op']; $shapePrimaryOptions['recLen'] -= $opt['op']; } break; case 0x17f: // Geometry Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd944968(v=office.12).aspx break; case 0x180: // Fill : fillType //@link : http://msdn.microsoft.com/en-us/library/dd947909(v=office.12).aspx break; case 0x181: // Fill : fillColor //@link : http://msdn.microsoft.com/en-us/library/dd921332(v=office.12).aspx $red = $opt['op'] >> 0 & bindec('11111111'); $green = $opt['op'] >> 8 & bindec('11111111'); $blue = $opt['op'] >> 16 & bindec('11111111'); $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); // echo 'fillColor : '.$strColor.EOL; break; case 0x183: // Fill : fillBackColor //@link : http://msdn.microsoft.com/en-us/library/dd950634(v=office.12).aspx $red = $opt['op'] >> 0 & bindec('11111111'); $green = $opt['op'] >> 8 & bindec('11111111'); $blue = $opt['op'] >> 16 & bindec('11111111'); $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); // echo 'fillBackColor : '.$strColor.EOL; break; case 0x193: // Fill : fillRectRight //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx // echo 'fillRectRight : '.\PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']).EOL; break; case 0x194: // Fill : fillRectBottom //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx // echo 'fillRectBottom : '.\PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']).EOL; break; case 0x1bf: // Fill : Fill Style Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd909380(v=office.12).aspx break; case 0x1c0: // Line Style : lineColor //@link : http://msdn.microsoft.com/en-us/library/dd920397(v=office.12).aspx $red = $opt['op'] >> 0 & bindec('11111111'); $green = $opt['op'] >> 8 & bindec('11111111'); $blue = $opt['op'] >> 16 & bindec('11111111'); $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); $arrShpPrimaryOpt['lineColor'] = $strColor; break; case 0x1c1: // Line Style : lineOpacity //@link : http://msdn.microsoft.com/en-us/library/dd923433(v=office.12).aspx // echo 'lineOpacity : '.dechex($opt['op']).EOL; break; case 0x1c2: // Line Style : lineBackColor //@link : http://msdn.microsoft.com/en-us/library/dd947669(v=office.12).aspx break; case 0x1cb: // Line Style : lineWidth //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx $arrShpPrimaryOpt['lineWidth'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x1d6: // Line Style : lineJoinStyle //@link : http://msdn.microsoft.com/en-us/library/dd909643(v=office.12).aspx break; case 0x1d7: // Line Style : lineEndCapStyle //@link : http://msdn.microsoft.com/en-us/library/dd925071(v=office.12).aspx break; case 0x1ff: // Line Style : Line Style Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx break; case 0x201: // Shadow Style : shadowColor //@link : http://msdn.microsoft.com/en-us/library/dd923454(v=office.12).aspx break; case 0x204: // Shadow Style : shadowOpacity //@link : http://msdn.microsoft.com/en-us/library/dd920720(v=office.12).aspx break; case 0x205: // Shadow Style : shadowOffsetX //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx $arrShpPrimaryOpt['shadowOffsetX'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x206: // Shadow Style : shadowOffsetY //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx $arrShpPrimaryOpt['shadowOffsetY'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); break; case 0x23f: // Shadow Style : Shadow Style Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd947887(v=office.12).aspx break; case 0x304: // Shape : bWMode //@link : http://msdn.microsoft.com/en-us/library/dd947659(v=office.12).aspx break; case 0x33f: // Shape Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx break; default: throw new \Exception('Feature not implemented (l.' . __LINE__ . ' : ' . dechex($opt['opid'] . ')')); break; } } $pos += $shapePrimaryOptions['recLen']; $rHeader['recLen'] -= $shapePrimaryOptions['recLen']; } $shpSecondaryOptions1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $bShpSecondaryOpt1 = false; if ($shpSecondaryOptions1['recVer'] == 0x3 && $shpSecondaryOptions1['recType'] == 0xf121) { $pos += 8; $rHeader['recLen'] -= 8; $bShpSecondaryOpt1 = true; // echo '@$rhShapeSecondaryOptions1'.EOL; } $shpTertiaryOptions1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $bShpTertiaryOptions1 = false; if ($shpTertiaryOptions1['recVer'] == 0x3 && $shpTertiaryOptions1['recType'] == 0xf122) { $pos += 8; $rHeader['recLen'] -= 8; $bShpTertiaryOptions1 = true; // echo '@$rhShapeTertiaryOptions1'.EOL; } $rhChildAnchor = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($rhChildAnchor['recVer'] == 0x0 && $rhChildAnchor['recInstance'] == 0x0 && $rhChildAnchor['recType'] == 0xf00f && $rhChildAnchor['recLen'] == 0x10) { $pos += 8; $rHeader['recLen'] -= 8; // echo '@$rhChildAnchor'.EOL; } $rhClientAnchor = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; //@link : http://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx if ($rhClientAnchor['recVer'] == 0x0 && $rhClientAnchor['recInstance'] == 0x0 && $rhClientAnchor['recType'] == 0xf010 && ($rhClientAnchor['recLen'] == 0x8 || $rhClientAnchor['recLen'] == 0x10)) { // echo '$rhClientAnchor'.EOL; switch ($rhClientAnchor['recLen']) { case 0x8: // echo '$rhClientAnchor:0x000000008'.EOL; $arrClientAnchor['top'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos) / 6; $arrClientAnchor['left'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos + 2) / 6; $arrClientAnchor['width'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos + 4) / 6 - $arrClientAnchor['left']; $arrClientAnchor['height'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos + 6) / 6 - $arrClientAnchor['left']; // print_r($arrClientAnchor); $pos += 8; break; case 0x10: // echo '@$rhClientAnchor:0x00000010'.EOL; break; } } else { $pos -= 8; $rHeader['recLen'] += 8; } //@link : http://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx $clientData = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; if ($clientData['recVer'] == 0xf && $clientData['recInstance'] == 0x0 && $clientData['recType'] == 0xf011) { // echo '@$clientData'.EOL; } else { $pos -= 8; $rHeader['recLen'] += 8; } //@link : http://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx $clientTextbox = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; if ($clientTextbox['recVer'] == 0xf && $clientTextbox['recInstance'] == 0x0 && $clientTextbox['recType'] == 0xf00d) { // echo '@$clientTextbox'.EOL; $strLen = 0; do { $rhRgChildRec = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; $clientTextbox['recLen'] -= 8; switch ($rhRgChildRec['recType']) { case self::RT_INTERACTIVEINFO: // echo '$clientTextbox:RT_InteractiveInfo'.EOL; //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx if ($rhRgChildRec['recInstance'] == 0x0) { //@link : http://msdn.microsoft.com/en-us/library/dd952348(v=office.12).aspx $rhInteractiveAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; $clientTextbox['recLen'] -= 8; if ($rhInteractiveAtom['recVer'] != 0x0 || $rhInteractiveAtom['recInstance'] != 0x0 || $rhInteractiveAtom['recType'] != self::RT_INTERACTIVEINFOATOM || $rhInteractiveAtom['recLen'] != 0x10) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rgfb > shapePrimaryOptions > clientTextbox).'); } // soundIdRef $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; // exHyperlinkIdRef $exHyperlinkIdRef = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; // action $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; // oleVerb $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; // jump $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; // fAnimated (1 bit) // fStopSound (1 bit) // fCustomShowReturn (1 bit) // fVisited (1 bit) // reserved (4 bits) $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; // hyperlinkType $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; // unused $pos += 3; $rHeader['recLen'] -= 3; $clientTextbox['recLen'] -= 3; // Shape $arrClientTextBox['hyperlink'][]['id'] = $exHyperlinkIdRef; } if ($rhRgChildRec['recInstance'] == 0x1) { // echo '@todo l.'.__LINE__; } break; case self::RT_STYLETEXTPROPATOM: // echo '$clientTextbox:RT_StyleTextPropAtom'.EOL; // @link : http://msdn.microsoft.com/en-us/library/dd950647(v=office.12).aspx $strLenRT = $strLen + 1; do { // rgTextPFRun $countRgTextPFRun = self::getInt4d($this->streamPowerpointDocument, $pos); $strLenRT -= $countRgTextPFRun; $arrClientTextBox['numTexts']++; $arrClientTextBox['text' . $arrClientTextBox['numTexts']] = array(); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; // indent $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $masks = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $masksData = array(); $masksData['hasBullet'] = $masks >> 0 & bindec('1'); $masksData['bulletHasFont'] = $masks >> 1 & bindec('1'); $masksData['bulletHasColor'] = $masks >> 2 & bindec('1'); $masksData['bulletHasSize'] = $masks >> 3 & bindec('1'); $masksData['bulletFont'] = $masks >> 4 & bindec('1'); $masksData['bulletColor'] = $masks >> 5 & bindec('1'); $masksData['bulletSize'] = $masks >> 6 & bindec('1'); $masksData['bulletChar'] = $masks >> 7 & bindec('1'); $masksData['leftMargin'] = $masks >> 8 & bindec('1'); $masksData['unused'] = $masks >> 9 & bindec('1'); $masksData['indent'] = $masks >> 10 & bindec('1'); $masksData['align'] = $masks >> 11 & bindec('1'); $masksData['lineSpacing'] = $masks >> 12 & bindec('1'); $masksData['spaceBefore'] = $masks >> 13 & bindec('1'); $masksData['spaceAfter'] = $masks >> 14 & bindec('1'); $masksData['defaultTabSize'] = $masks >> 15 & bindec('1'); $masksData['fontAlign'] = $masks >> 16 & bindec('1'); $masksData['charWrap'] = $masks >> 17 & bindec('1'); $masksData['wordWrap'] = $masks >> 18 & bindec('1'); $masksData['overflow'] = $masks >> 19 & bindec('1'); $masksData['tabStops'] = $masks >> 20 & bindec('1'); $masksData['textDirection'] = $masks >> 21 & bindec('1'); $masksData['reserved1'] = $masks >> 22 & bindec('1'); $masksData['bulletBlip'] = $masks >> 23 & bindec('1'); $masksData['bulletScheme'] = $masks >> 24 & bindec('1'); $masksData['bulletHasScheme'] = $masks >> 25 & bindec('1'); $bulletFlags = array(); if ($masksData['hasBullet'] == 1 || $masksData['bulletHasFont'] == 1 || $masksData['bulletHasColor'] == 1 || $masksData['bulletHasSize '] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $bulletFlags['fHasBullet'] = $data >> 0 & bindec('1'); $bulletFlags['fBulletHasFont'] = $data >> 1 & bindec('1'); $bulletFlags['fBulletHasColor'] = $data >> 2 & bindec('1'); $bulletFlags['fBulletHasSize'] = $data >> 3 & bindec('1'); } if ($masksData['bulletChar'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrClientTextBox['text' . $arrClientTextBox['numTexts']]['bulletChar'] = chr($data); } if ($masksData['bulletFont'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['bulletSize'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['bulletColor'] == 1) { $red = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $green = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $blue = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $index = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; if ($index == 0xfe) { $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); } } if ($masksData['align'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; switch ($data) { case 0x0: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_LEFT; break; case 0x1: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_CENTER; break; case 0x2: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_RIGHT; break; case 0x3: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_JUSTIFY; break; case 0x4: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; break; case 0x5: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; break; case 0x6: $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_JUSTIFY; break; default: break; } } if ($masksData['lineSpacing'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['spaceBefore'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['spaceAfter'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['leftMargin'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrClientTextBox['text' . $arrClientTextBox['numTexts']]['leftMargin'] = (int) round($data / 6); } if ($masksData['indent'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrClientTextBox['text' . $arrClientTextBox['numTexts']]['indent'] = (int) round($data / 6); } if ($masksData['defaultTabSize'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['tabStops'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['fontAlign'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['textDirection'] == 1) { // echo '@todo l.'.__LINE__; } } while ($strLenRT > 0); $strLenRT = $strLen + 1; do { // rgTextCFRun $countRgTextCFRun = self::getInt4d($this->streamPowerpointDocument, $pos); $strLenRT -= $countRgTextCFRun; $arrClientTextBox['numParts']++; $arrClientTextBox['part' . $arrClientTextBox['numParts']] = array(); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $arrClientTextBox['part' . $arrClientTextBox['numParts']]['length'] = $countRgTextCFRun; $masks = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $masksData = array(); $masksData['bold'] = $masks >> 0 & bindec('1'); $masksData['italic'] = $masks >> 1 & bindec('1'); $masksData['underline'] = $masks >> 2 & bindec('1'); $masksData['unused1'] = $masks >> 3 & bindec('1'); $masksData['shadow'] = $masks >> 4 & bindec('1'); $masksData['fehint'] = $masks >> 5 & bindec('1'); $masksData['unused2'] = $masks >> 6 & bindec('1'); $masksData['kumi'] = $masks >> 7 & bindec('1'); $masksData['unused3'] = $masks >> 8 & bindec('1'); $masksData['emboss'] = $masks >> 9 & bindec('1'); $masksData['fHasStyle'] = $masks >> 10 & bindec('1111'); $masksData['unused4'] = $masks >> 14 & bindec('11'); $masksData['typeface'] = $masks >> 16 & bindec('1'); $masksData['size'] = $masks >> 17 & bindec('1'); $masksData['color'] = $masks >> 18 & bindec('1'); $masksData['position'] = $masks >> 19 & bindec('1'); $masksData['pp10ext'] = $masks >> 20 & bindec('1'); $masksData['oldEATypeface'] = $masks >> 21 & bindec('1'); $masksData['ansiTypeface'] = $masks >> 22 & bindec('1'); $masksData['symbolTypeface'] = $masks >> 23 & bindec('1'); $masksData['newEATypeface'] = $masks >> 24 & bindec('1'); $masksData['csTypeface'] = $masks >> 25 & bindec('1'); $masksData['pp11ext'] = $masks >> 26 & bindec('1'); if ($masksData['bold'] == 1 || $masksData['italic'] == 1 || $masksData['underline'] == 1 || $masksData['shadow'] == 1 || $masksData['fehint'] == 1 || $masksData['kumi'] == 1 || $masksData['emboss'] == 1 || $masksData['fHasStyle'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $fontStyleFlags['bold'] = $data >> 0 & bindec('1'); $fontStyleFlags['italic'] = $data >> 1 & bindec('1'); $fontStyleFlags['underline'] = $data >> 2 & bindec('1'); $fontStyleFlags['unused1'] = $data >> 3 & bindec('1'); $fontStyleFlags['shadow'] = $data >> 4 & bindec('1'); $fontStyleFlags['fehint'] = $data >> 5 & bindec('1'); $fontStyleFlags['unused2'] = $data >> 6 & bindec('1'); $fontStyleFlags['kumi'] = $data >> 7 & bindec('1'); $fontStyleFlags['unused3'] = $data >> 8 & bindec('1'); $fontStyleFlags['emboss'] = $data >> 9 & bindec('1'); $fontStyleFlags['pp9rt'] = $data >> 10 & bindec('1111'); $fontStyleFlags['unused4'] = $data >> 14 & bindec('11'); $arrClientTextBox['part' . $arrClientTextBox['numParts']]['bold'] = $fontStyleFlags['bold'] == 1 ? true : false; $arrClientTextBox['part' . $arrClientTextBox['numParts']]['italic'] = $fontStyleFlags['italic'] == 1 ? true : false; $arrClientTextBox['part' . $arrClientTextBox['numParts']]['underline'] = $fontStyleFlags['underline'] == 1 ? true : false; } if ($masksData['typeface'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrClientTextBox['part' . $arrClientTextBox['numParts']]['fontName'] = isset($this->arrayFonts[$data]) ? $this->arrayFonts[$data] : ''; } if ($masksData['oldEATypeface'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['ansiTypeface'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['symbolTypeface'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['size'] == 1) { $arrClientTextBox['part' . $arrClientTextBox['numParts']]['fontSize'] = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['color'] == 1) { $red = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $green = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $blue = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; $index = self::getInt1d($this->streamPowerpointDocument, $pos); $pos += 1; $rHeader['recLen'] -= 1; $clientTextbox['recLen'] -= 1; if ($index == 0xfe) { $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); $arrClientTextBox['part' . $arrClientTextBox['numParts']]['color'] = new Color('FF' . $strColor); } } if ($masksData['position'] == 1) { // echo '@todo l.'.__LINE__; } } while ($strLenRT > 0); break; case self::RT_TEXTCHARSATOM: // echo '$clientTextbox:RT_TextCharsAtom'.EOL; // @link : http://msdn.microsoft.com/en-us/library/dd772921(v=office.12).aspx $strLen = (int) ($rhRgChildRec['recLen'] / 2); for ($inc = 0; $inc < $rhRgChildRec['recLen'] / 2; $inc++) { $char = self::getInt2d($this->streamPowerpointDocument, $pos); if ($char == 0xb) { $char = 0x20; } $arrClientTextBox['text'] .= chr($char); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } // echo $arrClientTextBox['text'].EOL; break; case self::RT_TEXTHEADERATOM: // echo '$clientTextbox:RT_TextHeaderAtom'.EOL; // @link : http://msdn.microsoft.com/en-us/library/dd905272(v=office.12).aspx // textType $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; break; case self::RT_TEXTINTERACTIVEINFOATOM: // echo '$clientTextbox:RT_TextInteractiveInfoAtom'.EOL; //@link : http://msdn.microsoft.com/en-us/library/dd947973(v=office.12).aspx if ($rhRgChildRec['recInstance'] == 0x0) { //@link : http://msdn.microsoft.com/en-us/library/dd944072(v=office.12).aspx $arrClientTextBox['hyperlink'][count($arrClientTextBox['hyperlink']) - 1]['start'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $arrClientTextBox['hyperlink'][count($arrClientTextBox['hyperlink']) - 1]['end'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; } if ($rhRgChildRec['recInstance'] == 0x1) { // echo '@todo l.'.__LINE__; } break; case self::RT_TEXTSPECIALINFOATOM: // echo '$clientTextbox:RT_TextSpecialInfoAtom'.EOL; // @link : http://msdn.microsoft.com/en-us/library/dd945296(v=office.12).aspx $strLenRT = $strLen + 1; do { $count = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $strLenRT -= $count; $data = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $masksData = array(); $masksData['spell'] = $data >> 0 & bindec('1'); $masksData['lang'] = $data >> 1 & bindec('1'); $masksData['altLang'] = $data >> 2 & bindec('1'); $masksData['unused1'] = $data >> 3 & bindec('1'); $masksData['unused2'] = $data >> 4 & bindec('1'); $masksData['fPp10ext'] = $data >> 5 & bindec('1'); $masksData['fBidi'] = $data >> 6 & bindec('1'); $masksData['unused3'] = $data >> 7 & bindec('1'); $masksData['reserved1'] = $data >> 8 & bindec('1'); $masksData['smartTag'] = $data >> 9 & bindec('1'); if ($masksData['spell'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $masksSpell = array(); $masksSpell['error'] = $data >> 0 & bindec('1'); $masksSpell['clean'] = $data >> 1 & bindec('1'); $masksSpell['grammar'] = $data >> 2 & bindec('1'); } if ($masksData['lang'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['altLang'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fBidi'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['fPp10ext'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['smartTag'] == 1) { // echo '@todo l.'.__LINE__; } } while ($strLenRT > 0); break; case self::RT_TEXTRULERATOM: // echo '$clientTextbox:RT_TextRulerAtom'.EOL; // @link : http://msdn.microsoft.com/en-us/library/dd953212(v=office.12).aspx $data = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; $clientTextbox['recLen'] -= 4; $masksData = array(); $masksData['fDefaultTabSize'] = $data >> 0 & bindec('1'); $masksData['fCLevels'] = $data >> 1 & bindec('1'); $masksData['fTabStops'] = $data >> 2 & bindec('1'); $masksData['fLeftMargin1'] = $data >> 3 & bindec('1'); $masksData['fLeftMargin2'] = $data >> 4 & bindec('1'); $masksData['fLeftMargin3'] = $data >> 5 & bindec('1'); $masksData['fLeftMargin4'] = $data >> 6 & bindec('1'); $masksData['fLeftMargin5'] = $data >> 7 & bindec('1'); $masksData['fIndent1'] = $data >> 8 & bindec('1'); $masksData['fIndent2'] = $data >> 9 & bindec('1'); $masksData['fIndent3'] = $data >> 10 & bindec('1'); $masksData['fIndent4'] = $data >> 11 & bindec('1'); $masksData['fIndent5'] = $data >> 12 & bindec('1'); if ($masksData['fCLevels'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['fDefaultTabSize'] == 1) { // echo '@todo l.'.__LINE__; } if ($masksData['fTabStops'] == 1) { $count = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrayTabStops = array(); for ($inc = 0; $inc < $count; $inc++) { $position = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $type = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; $arrayTabStops[] = array('position' => $position, 'type' => $type); } } if ($masksData['fLeftMargin1'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent1'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin2'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent2'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin3'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent3'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin4'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent4'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin5'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent5'] == 1) { $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } break; default: // echo EOL; // print_r($rhRgChildRec); // echo EOL; // echo '@$type : '.dechex($rhRgChildRec['recType']).EOL; } } while ($clientTextbox['recLen'] > 0); } else { $pos -= 8; $rHeader['recLen'] += 8; } $shpSecondaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; if ($bShpSecondaryOpt1 == true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xf121) { } else { $pos -= 8; $rHeader['recLen'] += 8; } $shpTertiaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; if ($bShpTertiaryOptions1 == true && $shpTertiaryOptions2['recVer'] == 0x3 && $shpTertiaryOptions2['recType'] == 0xf122) { } else { $pos -= 8; $rHeader['recLen'] += 8; } break; } // Cleaning variables if (empty($arrClientTextBox['hyperlink'])) { unset($arrClientTextBox['hyperlink']); } if (empty($arrClientTextBox['text'])) { unset($arrClientTextBox['text']); } if (empty($arrClientTextBox['numParts'])) { unset($arrClientTextBox['numParts']); } if (empty($arrClientTextBox['numTexts'])) { unset($arrClientTextBox['numTexts']); } // echo EOL; if (isset($arrShpPrimaryOpt['pib']) && isset($this->arrayPictures[$arrShpPrimaryOpt['pib'] - 1])) { // echo '//IMAGE'.EOL; $gdImage = imagecreatefromstring($this->arrayPictures[$arrShpPrimaryOpt['pib'] - 1]); $shape = new MemoryDrawing(); $shape->setImageResource($gdImage); if (isset($arrShpPrimaryOpt['shadowOffsetX']) && $arrShpPrimaryOpt['shadowOffsetX'] != 0 && isset($arrShpPrimaryOpt['shadowOffsetY']) && $arrShpPrimaryOpt['shadowOffsetY'] != 0) { $shape->getShadow()->setVisible(true); if ($arrShpPrimaryOpt['shadowOffsetX'] > 0 && $arrShpPrimaryOpt['shadowOffsetX'] == $arrShpPrimaryOpt['shadowOffsetY']) { $shape->getShadow()->setDistance($arrShpPrimaryOpt['shadowOffsetX'])->setDirection(45); } } if (!is_null($shape) && !empty($arrClientAnchor)) { $shape->setOffsetX($arrClientAnchor['left']); $shape->setOffsetY($arrClientAnchor['top']); $shape->setWidth($arrClientAnchor['width']); $shape->setHeight($arrClientAnchor['height']); } } if (!empty($arrClientTextBox) && isset($arrClientTextBox)) { // echo '//TEXT'.EOL; // echo '<pre>'; // print_r($arrClientTextBox); // echo '</pre>'; $shape = new RichText(); if (isset($arrClientTextBox['alignH'])) { $shape->getActiveParagraph()->getAlignment()->setHorizontal($arrClientTextBox['alignH']); } $start = 0; // echo $arrClientTextBox['text'].EOL; $lastLevel = -1; $lastMarginLeft = 0; for ($inc = 1; $inc <= $arrClientTextBox['numParts']; $inc++) { if ($arrClientTextBox['numParts'] == $arrClientTextBox['numTexts'] && isset($arrClientTextBox['text' . $inc])) { if (isset($arrClientTextBox['text' . $inc]['bulletChar'])) { $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); $shape->getActiveParagraph()->getBulletStyle()->setBulletChar($arrClientTextBox['text' . $inc]['bulletChar']); } // Indent $indent = 0; if (isset($arrClientTextBox['text' . $inc]['indent'])) { $indent = $arrClientTextBox['text' . $inc]['indent']; } if (isset($arrClientTextBox['text' . $inc]['leftMargin'])) { if ($lastMarginLeft > $arrClientTextBox['text' . $inc]['leftMargin']) { $lastLevel--; } if ($lastMarginLeft < $arrClientTextBox['text' . $inc]['leftMargin']) { $lastLevel++; } $shape->getActiveParagraph()->getAlignment()->setLevel($lastLevel); $lastMarginLeft = $arrClientTextBox['text' . $inc]['leftMargin']; $shape->getActiveParagraph()->getAlignment()->setMarginLeft($arrClientTextBox['text' . $inc]['leftMargin']); $shape->getActiveParagraph()->getAlignment()->setIndent($indent - $arrClientTextBox['text' . $inc]['leftMargin']); } } // Texte $sText = substr($arrClientTextBox['text'], $start, $arrClientTextBox['part' . $inc]['length']); $sHyperlinkURL = ''; if (empty($sText)) { // Is there a hyperlink ? if (!empty($arrClientTextBox['hyperlink'])) { foreach ($arrClientTextBox['hyperlink'] as $itmHyperlink) { if ($itmHyperlink['start'] == $start && $itmHyperlink['end'] - $itmHyperlink['start'] == $arrClientTextBox['part' . $inc]['length']) { $sText = $this->arrayHyperlinks[$itmHyperlink['id']]['text']; $sHyperlinkURL = $this->arrayHyperlinks[$itmHyperlink['id']]['url']; break; } } } } // New paragraph $bCreateParagraph = false; if (strpos($sText, "\r") != false) { $bCreateParagraph = true; $sText = str_replace("\r", '', $sText); } // TextRun $txtRun = $shape->createTextRun($sText); if (isset($arrClientTextBox['part' . $inc]['bold'])) { $txtRun->getFont()->setBold($arrClientTextBox['part' . $inc]['bold']); } if (isset($arrClientTextBox['part' . $inc]['italic'])) { $txtRun->getFont()->setItalic($arrClientTextBox['part' . $inc]['italic']); } if (isset($arrClientTextBox['part' . $inc]['underline'])) { $txtRun->getFont()->setUnderline($arrClientTextBox['part' . $inc]['underline']); } if (isset($arrClientTextBox['part' . $inc]['fontName'])) { $txtRun->getFont()->setName($arrClientTextBox['part' . $inc]['fontName']); } if (isset($arrClientTextBox['part' . $inc]['fontSize'])) { $txtRun->getFont()->setSize($arrClientTextBox['part' . $inc]['fontSize']); } if (isset($arrClientTextBox['part' . $inc]['color'])) { $txtRun->getFont()->setColor($arrClientTextBox['part' . $inc]['color']); } // Hyperlink if (!empty($sHyperlinkURL)) { $txtRun->setHyperlink(new Hyperlink($sHyperlinkURL)); } $start += $arrClientTextBox['part' . $inc]['length']; if ($bCreateParagraph) { $shape->createParagraph(); } } if (!is_null($shape) && !empty($arrClientAnchor)) { $shape->setOffsetX($arrClientAnchor['left']); $shape->setOffsetY($arrClientAnchor['top']); $shape->setWidth($arrClientAnchor['width']); $shape->setHeight($arrClientAnchor['height']); } } if (isset($arrShpPrimaryOpt['line']) && $arrShpPrimaryOpt['line'] == true) { // echo '//LINE'.EOL; $shape = new Line(0, 0, 0, 0); if (isset($arrShpPrimaryOpt['lineColor'])) { $shape->getBorder()->getColor()->setARGB('FF' . $arrShpPrimaryOpt['lineColor']); } if (!empty($arrClientAnchor)) { $shape->setOffsetX($arrClientAnchor['left']); $shape->setOffsetY($arrClientAnchor['top']); $shape->setWidth($arrClientAnchor['width']); $shape->setHeight($arrShpPrimaryOpt['lineWidth']); } } if (isset($arrShpPrimaryOpt['insetBottom'])) { $shape->setInsetBottom($arrShpPrimaryOpt['insetBottom']); } if (isset($arrShpPrimaryOpt['insetLeft'])) { $shape->setInsetLeft($arrShpPrimaryOpt['insetLeft']); } if (isset($arrShpPrimaryOpt['insetRight'])) { $shape->setInsetRight($arrShpPrimaryOpt['insetRight']); } if (isset($arrShpPrimaryOpt['insetTop'])) { $shape->setInsetTop($arrShpPrimaryOpt['insetTop']); } if (!is_null($shape) && $shape instanceof AbstractShape) { // echo '//SHAPE'.EOL; $oSlide->addShape($shape); } // echo '//END.....'.EOL.EOL.EOL; } while ($rHeader['recLen'] > 0); // *** slideSchemeColorSchemeAtom (40 bytes) // slideSchemeColorSchemeAtom > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x1 || $rHeader['recType'] != self::RT_COLORSCHEMEATOM || $rHeader['recLen'] != 0x20) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > slideSchemeColorSchemeAtom > rh).'); } // slideSchemeColorSchemeAtom > rgSchemeColor $rgSchemeColor = array(); for ($inc = 0; $inc <= 7; $inc++) { $rgSchemeColor[] = array('red' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4), 'green' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4 + 1), 'blue' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4 + 2)); } $pos += 8 * 4; // *** slideNameAtom (variable) // *** slideProgTagsContainer (variable). // slideProgTagsContainer > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; if ($rHeader['recVer'] != 0xf || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != self::RT_PROGTAGS) { throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > slideProgTagsContainer > rh).'); } }