| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |  * PHPExcel_Reader_Excel5_Escher | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * Copyright (c) 2006 - 2015 PHPExcel | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License as published by the Free Software Foundation; either | 
					
						
							|  |  |  |  * version 2.1 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |  * Lesser General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License along with this library; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category   PHPExcel | 
					
						
							|  |  |  |  * @package    PHPExcel_Reader_Excel5 | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  |  * @version    ##VERSION##, ##DATE##
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class PHPExcel_Reader_Excel5_Escher | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |     const DGGCONTAINER      = 0xF000; | 
					
						
							|  |  |  |     const BSTORECONTAINER   = 0xF001; | 
					
						
							|  |  |  |     const DGCONTAINER       = 0xF002; | 
					
						
							|  |  |  |     const SPGRCONTAINER     = 0xF003; | 
					
						
							|  |  |  |     const SPCONTAINER       = 0xF004; | 
					
						
							|  |  |  |     const DGG               = 0xF006; | 
					
						
							|  |  |  |     const BSE               = 0xF007; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     const DG                = 0xF008; | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |     const SPGR              = 0xF009; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     const SP                = 0xF00A; | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |     const OPT               = 0xF00B; | 
					
						
							|  |  |  |     const CLIENTTEXTBOX     = 0xF00D; | 
					
						
							|  |  |  |     const CLIENTANCHOR      = 0xF010; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     const CLIENTDATA        = 0xF011; | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |     const BLIPJPEG          = 0xF01D; | 
					
						
							|  |  |  |     const BLIPPNG           = 0xF01E; | 
					
						
							|  |  |  |     const SPLITMENUCOLORS   = 0xF11E; | 
					
						
							|  |  |  |     const TERTIARYOPT       = 0xF122; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Escher stream data (binary) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private $data; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Size in bytes of the Escher stream data | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private $dataSize; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Current position of stream pointer in Escher stream data | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private $pos; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The object to be returned by the reader. Modified during load. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var mixed | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private $object; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Create a new PHPExcel_Reader_Excel5_Escher instance | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param mixed $object | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __construct($object) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object = $object; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Load Escher stream data. May be a partial Escher stream. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $data | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function load($data) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->data = $data; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // total byte size of Excel data (workbook global substream + sheet substreams)
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->dataSize = strlen($this->data); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos = 0; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // Parse Escher stream
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         while ($this->pos < $this->dataSize) { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // offset: 2; size: 2: Record Type
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |             $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             switch ($fbt) { | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                 case self::DGGCONTAINER: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readDggContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::DGG: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readDgg(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::BSTORECONTAINER: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readBstoreContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::BSE: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readBSE(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::BLIPJPEG: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readBlipJPEG(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::BLIPPNG: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readBlipPNG(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::OPT: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readOPT(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::TERTIARYOPT: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readTertiaryOPT(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::SPLITMENUCOLORS: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readSplitMenuColors(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::DGCONTAINER: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readDgContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::DG: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readDg(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::SPGRCONTAINER: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readSpgrContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::SPCONTAINER: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readSpContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::SPGR: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readSpgr(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::SP: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readSp(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::CLIENTTEXTBOX: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readClientTextbox(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::CLIENTANCHOR: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readClientAnchor(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case self::CLIENTDATA: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readClientData(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 default: | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |                     $this->readDefault(); | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |                     break; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         return $this->object; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read a generic record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readDefault() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset 0; size: 2; recVer and recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // offset: 2; size: 2: Record Type
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // bit: 0-3; mask: 0x000F; recVer
 | 
					
						
							|  |  |  |         $recVer = (0x000F & $verInstance) >> 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read DggContainer record (Drawing Group Container) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readDggContainer() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setDggContainer($dggContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); | 
					
						
							|  |  |  |         $reader->load($recordData); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read Dgg record (Drawing Group) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readDgg() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read BstoreContainer record (Blip Store Container) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readBstoreContainer() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setBstoreContainer($bstoreContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); | 
					
						
							|  |  |  |         $reader->load($recordData); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read BSE record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readBSE() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // add BSE to BstoreContainer
 | 
					
						
							|  |  |  |         $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->addBSE($BSE); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $BSE->setBLIPType($recInstance); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 0; size: 1; btWin32 (MSOBLIPTYPE)
 | 
					
						
							|  |  |  |         $btWin32 = ord($recordData[0]); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 1; size: 1; btWin32 (MSOBLIPTYPE)
 | 
					
						
							|  |  |  |         $btMacOS = ord($recordData[1]); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 2; size: 16; MD4 digest
 | 
					
						
							|  |  |  |         $rgbUid = substr($recordData, 2, 16); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 18; size: 2; tag
 | 
					
						
							|  |  |  |         $tag = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 18); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 20; size: 4; size of BLIP in bytes
 | 
					
						
							|  |  |  |         $size = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 20); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 24; size: 4; number of references to this BLIP
 | 
					
						
							|  |  |  |         $cRef = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 24); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 28; size: 4; MSOFO file offset
 | 
					
						
							|  |  |  |         $foDelay = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 28); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 32; size: 1; unused1
 | 
					
						
							|  |  |  |         $unused1 = ord($recordData{32}); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 33; size: 1; size of nameData in bytes (including null terminator)
 | 
					
						
							|  |  |  |         $cbName = ord($recordData{33}); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 34; size: 1; unused2
 | 
					
						
							|  |  |  |         $unused2 = ord($recordData{34}); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 35; size: 1; unused3
 | 
					
						
							|  |  |  |         $unused3 = ord($recordData{35}); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 36; size: $cbName; nameData
 | 
					
						
							|  |  |  |         $nameData = substr($recordData, 36, $cbName); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 36 + $cbName, size: var; the BLIP data
 | 
					
						
							|  |  |  |         $blipData = substr($recordData, 36 + $cbName); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($BSE); | 
					
						
							|  |  |  |         $reader->load($blipData); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Read BlipJPEG record. Holds raw JPEG image data | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readBlipJPEG() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $pos = 0; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 0; size: 16; rgbUid1 (MD4 digest of)
 | 
					
						
							|  |  |  |         $rgbUid1 = substr($recordData, 0, 16); | 
					
						
							|  |  |  |         $pos += 16; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
 | 
					
						
							|  |  |  |         if (in_array($recInstance, array(0x046B, 0x06E3))) { | 
					
						
							|  |  |  |             $rgbUid2 = substr($recordData, 16, 16); | 
					
						
							|  |  |  |             $pos += 16; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: var; size: 1; tag
 | 
					
						
							|  |  |  |         $tag = ord($recordData{$pos}); | 
					
						
							|  |  |  |         $pos += 1; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: var; size: var; the raw image data
 | 
					
						
							|  |  |  |         $data = substr($recordData, $pos); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); | 
					
						
							|  |  |  |         $blip->setData($data); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setBlip($blip); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Read BlipPNG record. Holds raw PNG image data | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readBlipPNG() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $pos = 0; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 0; size: 16; rgbUid1 (MD4 digest of)
 | 
					
						
							|  |  |  |         $rgbUid1 = substr($recordData, 0, 16); | 
					
						
							|  |  |  |         $pos += 16; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
 | 
					
						
							|  |  |  |         if ($recInstance == 0x06E1) { | 
					
						
							|  |  |  |             $rgbUid2 = substr($recordData, 16, 16); | 
					
						
							|  |  |  |             $pos += 16; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: var; size: 1; tag
 | 
					
						
							|  |  |  |         $tag = ord($recordData{$pos}); | 
					
						
							|  |  |  |         $pos += 1; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // offset: var; size: var; the raw image data
 | 
					
						
							|  |  |  |         $data = substr($recordData, $pos); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); | 
					
						
							|  |  |  |         $blip->setData($data); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setBlip($blip); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read OPT record. This record may occur within DggContainer record or SpContainer | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readOPT() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->readOfficeArtRGFOPTE($recordData, $recInstance); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read TertiaryOPT record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readTertiaryOPT() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read SplitMenuColors record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readSplitMenuColors() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read DgContainer record (Drawing Container) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readDgContainer() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setDgContainer($dgContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); | 
					
						
							|  |  |  |         $escher = $reader->load($recordData); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read Dg record (Drawing) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readDg() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read SpgrContainer record (Shape Group Container) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readSpgrContainer() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // context is either context DgContainer or SpgrContainer
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // DgContainer
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |             $this->object->setSpgrContainer($spgrContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             // SpgrContainer
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |             $this->object->addChild($spgrContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); | 
					
						
							|  |  |  |         $escher = $reader->load($recordData); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read SpContainer record (Shape Container) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readSpContainer() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // add spContainer to spgrContainer
 | 
					
						
							|  |  |  |         $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->addChild($spContainer); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // record is a container, read contents
 | 
					
						
							|  |  |  |         $reader = new PHPExcel_Reader_Excel5_Escher($spContainer); | 
					
						
							|  |  |  |         $escher = $reader->load($recordData); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read Spgr record (Shape Group) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readSpgr() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read Sp record (Shape) | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readSp() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read ClientTextbox record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readClientTextbox() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // offset: 0; size: 2; recVer and recInstance
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // bit: 4-15; mask: 0xFFF0; recInstance
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readClientAnchor() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // offset: 2; size: 2; upper-left corner column index (0-based)
 | 
					
						
							|  |  |  |         $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
 | 
					
						
							|  |  |  |         $startOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 6; size: 2; upper-left corner row index (0-based)
 | 
					
						
							|  |  |  |         $r1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 6); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
 | 
					
						
							|  |  |  |         $startOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 8); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 10; size: 2; bottom-right corner column index (0-based)
 | 
					
						
							|  |  |  |         $c2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 10); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
 | 
					
						
							|  |  |  |         $endOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 12); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 14; size: 2; bottom-right corner row index (0-based)
 | 
					
						
							|  |  |  |         $r2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 14); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
 | 
					
						
							|  |  |  |         $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // set the start coordinates
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // set the start offsetX
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setStartOffsetX($startOffsetX); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // set the start offsetY
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setStartOffsetY($startOffsetY); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // set the end coordinates
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // set the end offsetX
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setEndOffsetX($endOffsetX); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // set the end offsetY
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->object->setEndOffsetY($endOffsetY); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Read ClientData record | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readClientData() | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); | 
					
						
							|  |  |  |         $recordData = substr($this->data, $this->pos + 8, $length); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // move stream pointer to next record
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |         $this->pos += 8 + $length; | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Read OfficeArtRGFOPTE table of property-value pairs | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $data Binary data | 
					
						
							|  |  |  |      * @param int $n Number of properties | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |     private function readOfficeArtRGFOPTE($data, $n) | 
					
						
							| 
									
										
										
										
											2015-05-17 10:11:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         $splicedComplexData = substr($data, 6 * $n); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         // loop through property-value pairs
 | 
					
						
							|  |  |  |         for ($i = 0; $i < $n; ++$i) { | 
					
						
							|  |  |  |             // read 6 bytes at a time
 | 
					
						
							|  |  |  |             $fopte = substr($data, 6 * $i, 6); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // offset: 0; size: 2; opid
 | 
					
						
							|  |  |  |             $opid = PHPExcel_Reader_Excel5::_GetInt2d($fopte, 0); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // bit: 0-13; mask: 0x3FFF; opid.opid
 | 
					
						
							|  |  |  |             $opidOpid = (0x3FFF & $opid) >> 0; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier
 | 
					
						
							|  |  |  |             $opidFBid = (0x4000 & $opid) >> 14; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data
 | 
					
						
							|  |  |  |             $opidFComplex = (0x8000 & $opid) >> 15; | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             // offset: 2; size: 4; the value for this property
 | 
					
						
							|  |  |  |             $op = PHPExcel_Reader_Excel5::_GetInt4d($fopte, 2); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |             if ($opidFComplex) { | 
					
						
							|  |  |  |                 $complexData = substr($splicedComplexData, 0, $op); | 
					
						
							|  |  |  |                 $splicedComplexData = substr($splicedComplexData, $op); | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |                 // we store string value with complex data
 | 
					
						
							|  |  |  |                 $value = $complexData; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 // we store integer value
 | 
					
						
							|  |  |  |                 $value = $op; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-18 15:39:04 +00:00
										 |  |  |             $this->object->setOPT($opidOpid, $value); | 
					
						
							| 
									
										
										
										
											2015-05-12 09:22:06 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-26 19:14:53 +00:00
										 |  |  | } |