Skip to content

Commit

Permalink
Merge pull request #633 from Progi1984/issue605
Browse files Browse the repository at this point in the history
#605 : Fixed Stacked or PercentStacked Charts
  • Loading branch information
Progi1984 committed May 31, 2021
2 parents 49d3fe5 + 50890dc commit 2ef3159
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -18,6 +18,7 @@ matrix:
env:
global:
- secure: "LtlUOzC8FtqgbqUTmU7EU281NSCb58UFdvnz8lelNIDltBdP4eayN/TsgNIePB4jXg2d2R56ZA6j/grhE/md6jdUkulV355H3GrH/hIZmmQ+F9+87agnwLzb9+MJbqXoiE7VvjY3zGIO09G897SUfsfu6JWEcscYFlsH6KcXM6M="
- XDEBUG_MODE=coverage

addons:
apt:
Expand Down
6 changes: 6 additions & 0 deletions phpmd.xml.dist
Expand Up @@ -6,12 +6,18 @@
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable" />
<exclude name="ShortClassName" />
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="32" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortClassName">
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
Expand Down
26 changes: 13 additions & 13 deletions src/PhpPresentation/Reader/PowerPoint97.php
Expand Up @@ -568,13 +568,13 @@ private function loadCurrentUserStream()
$pos += 2;

// ansiUserName
$ansiUserName = '';
// $ansiUserName = '';
do {
$char = self::getInt1d($this->streamCurrentUser, $pos);
if (($char >= 0x00 && $char <= 0x1F) || ($char >= 0x7F && $char <= 0x9F)) {
$char = false;
} else {
$ansiUserName .= chr($char);
// $ansiUserName .= chr($char);
$pos += 1;
}
} while ($char !== false);
Expand All @@ -587,13 +587,13 @@ private function loadCurrentUserStream()
}

// unicodeUserName
$unicodeUserName = '';
// $unicodeUserName = '';
for ($inc = 0; $inc < $lenUserName; $inc++) {
$char = self::getInt2d($this->streamCurrentUser, $pos);
if (($char >= 0x00 && $char <= 0x1F) || ($char >= 0x7F && $char <= 0x9F)) {
break;
}
$unicodeUserName .= chr($char);
// $unicodeUserName .= chr($char);
$pos += 2;
}
}
Expand All @@ -611,11 +611,11 @@ private function loadPowerpointDocumentStream()
foreach ($this->rgPersistDirEntry as $offsetDir) {
$pos = $offsetDir;

$rh = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
$rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
$pos += 8;
$this->inMainType = $rh['recType'];
$this->inMainType = $rHeader['recType'];
$this->currentNote = null;
switch ($rh['recType']) {
switch ($rHeader['recType']) {
case self::RT_DOCUMENT:
$this->readRecordDocumentContainer($this->streamPowerpointDocument, $pos);
break;
Expand Down Expand Up @@ -3168,19 +3168,19 @@ private function readStructureTextPFRun($stream, $pos, $strLenRT)
$arrayReturn['length'] += 2;
}
if ($masksData['bulletColor'] == 1) {
$red = self::getInt1d($stream, $pos + $arrayReturn['length']);
// $red = self::getInt1d($stream, $pos + $arrayReturn['length']);
$arrayReturn['length'] += 1;
$green = self::getInt1d($stream, $pos + $arrayReturn['length']);
// $green = self::getInt1d($stream, $pos + $arrayReturn['length']);
$arrayReturn['length'] += 1;
$blue = self::getInt1d($stream, $pos + $arrayReturn['length']);
// $blue = self::getInt1d($stream, $pos + $arrayReturn['length']);
$arrayReturn['length'] += 1;
$index = self::getInt1d($stream, $pos + $arrayReturn['length']);
$arrayReturn['length'] += 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');
// $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) {
Expand Down
6 changes: 3 additions & 3 deletions src/PhpPresentation/Writer/ODPresentation.php
Expand Up @@ -107,12 +107,12 @@ public function save($pFilename)
}

$class = __NAMESPACE__ . '\\ODPresentation\\' . $oFile->getBasename('.php');
$o = new \ReflectionClass($class);
$class = new \ReflectionClass($class);

if ($o->isAbstract() || !$o->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) {
if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) {
continue;
}
$arrayFiles[$oFile->getBasename('.php')] = $o;
$arrayFiles[$oFile->getBasename('.php')] = $class;
}

ksort($arrayFiles);
Expand Down
6 changes: 3 additions & 3 deletions src/PhpPresentation/Writer/PowerPoint2007.php
Expand Up @@ -109,12 +109,12 @@ public function save($pFilename)
}

$class = __NAMESPACE__ . '\\PowerPoint2007\\' . $oFile->getBasename('.php');
$o = new \ReflectionClass($class);
$class = new \ReflectionClass($class);

if ($o->isAbstract() || !$o->isSubclassOf('PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractDecoratorWriter')) {
if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractDecoratorWriter')) {
continue;
}
$arrayFiles[$oFile->getBasename('.php')] = $o;
$arrayFiles[$oFile->getBasename('.php')] = $class;
}

ksort($arrayFiles);
Expand Down
2 changes: 1 addition & 1 deletion src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
Expand Up @@ -980,7 +980,7 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee
if ($barGrouping === Bar::GROUPING_CLUSTERED) {
$objWriter->writeAttribute('val', '0');
} elseif ($barGrouping === Bar::GROUPING_STACKED || $barGrouping === Bar::GROUPING_PERCENTSTACKED) {
$objWriter->writeAttribute('val', '100000');
$objWriter->writeAttribute('val', '100');
}
$objWriter->endElement();

Expand Down

0 comments on commit 2ef3159

Please sign in to comment.