Skip to content

Commit

Permalink
#15 : PowerPoint97 Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jul 31, 2014
1 parent 8beb3ca commit 057739d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
19 changes: 6 additions & 13 deletions src/PhpPowerpoint/Reader/PowerPoint97.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,15 +747,8 @@ private function readRTSlide($pos)
$pos += 4;
// slideAtom > notesIdRef
$pos += 4;

// slideAtom > slideFlags
$slideFlags = self::getInt2d($this->streamPowerpointDocument, $pos);
// $fMasterObjects = ($slideFlags >> 0) & bindec('1');
// $fMasterScheme = ($slideFlags >> 1) & bindec('1');
// $fMasterBackground = ($slideFlags >> 2) & bindec('1');
// $reserved = ($slideFlags >> 3) & bindec('1111111111111');
$pos += 2;

// slideAtom > unused;
$pos += 2;
// *** slideShowSlideInfoAtom (24 bytes)
Expand Down Expand Up @@ -880,7 +873,7 @@ private function readRTSlide($pos)
$rHeader['recLen'] -= 8;
// print_r('$shapePrimaryOptions'.EOL);
//@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx
$OfficeArtFOPTE = array();
$officeArtFOPTE = array();
for ($inc = 0; $inc < $shapePrimaryOptions['recInstance']; $inc++) {
$opid = self::getInt2d($this->streamPowerpointDocument, $pos);
$pos += 2;
Expand All @@ -890,15 +883,15 @@ private function readRTSlide($pos)
$pos += 4;
$rHeader['recLen'] -= 4;
$shapePrimaryOptions['recLen'] -= 4;
$OfficeArtFOPTE[] = array(
$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) {
foreach ($officeArtFOPTE as $opt) {
switch ($opt['opid']) {
case 0x007F:
// Transform : Protection Boolean Properties
Expand Down Expand Up @@ -1144,11 +1137,11 @@ private function readRTSlide($pos)
}

$shpSecondaryOptions1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
$bShpSecondaryOptions1 = false;
$bShpSecondaryOpt1 = false;
if ($shpSecondaryOptions1['recVer'] == 0x3 && $shpSecondaryOptions1['recType'] == 0xF121) {
$pos += 8;
$rHeader['recLen'] -= 8;
$bShpSecondaryOptions1 = true;
$bShpSecondaryOpt1 = true;
// echo '@$rhShapeSecondaryOptions1'.EOL;
}

Expand Down Expand Up @@ -1813,7 +1806,7 @@ private function readRTSlide($pos)
$shpSecondaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
$pos += 8;
$rHeader['recLen'] -= 8;
if ($shpSecondaryOptions2 == true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xF121) {
if ($bShpSecondaryOpt1 == true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xF121) {
} else {
$pos -= 8;
$rHeader['recLen'] += 8;
Expand Down
6 changes: 3 additions & 3 deletions src/PhpPowerpoint/Shared/OLERead.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
defined('IDENTIFIER_OLE') ||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));

class OLERead
class OLERead
{
private $data = '';

Expand Down Expand Up @@ -65,7 +65,7 @@ class OLERead
const SIZE_POS = 0x78;

public $summaryInformation = null;
public $docSummaryInformation = null;
public $docSummaryInfos = null;
public $powerpointDocument = null;
public $currentUser = null;
public $pictures = null;
Expand Down Expand Up @@ -285,7 +285,7 @@ private function readPropertySets()
$this->summaryInformation = count($this->props) - 1;
break;
case chr(5).'DOCUMENTSUMMARYINFORMATION':
$this->docSummaryInformation = count($this->props) - 1;
$this->docSummaryInfos = count($this->props) - 1;
break;
case 'CURRENT USER':
$this->currentUser = count($this->props) - 1;
Expand Down
20 changes: 0 additions & 20 deletions tests/PhpPowerpoint/Tests/Writer/SerializedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,6 @@ public function testSave()
$this->assertFileExists($file, $object->save($file));
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not
*/
public function testSaveNoRightFile()
{
$oPHPPowerPoint = new PhpPowerpoint();
$oSlide = $oPHPPowerPoint->getActiveSlide();
$oImage = $oSlide->createDrawingShape();
$oImage->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png');
$object = new Serialized($oPHPPowerPoint);

$file = tempnam(sys_get_temp_dir(), 'PhpPowerpoint_Serialized');

file_put_contents($file, '');
chmod($file, 0000);

$this->assertFileExists($file, $object->save($file));
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not open
Expand Down

0 comments on commit 057739d

Please sign in to comment.