horizontal = self::HORIZONTAL_LEFT; $this->vertical = self::VERTICAL_BASE; } /** * Get Horizontal * * @return string */ public function getHorizontal() { return $this->horizontal; } /** * Set Horizontal * * @param string $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setHorizontal($pValue = self::HORIZONTAL_LEFT) { if ($pValue == '') { $pValue = self::HORIZONTAL_LEFT; } $this->horizontal = $pValue; return $this; } /** * Get Vertical * * @return string */ public function getVertical() { return $this->vertical; } /** * Set Vertical * * @param string $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setVertical($pValue = self::VERTICAL_BASE) { if ($pValue == '') { $pValue = self::VERTICAL_BASE; } $this->vertical = $pValue; return $this; } /** * Get Level * * @return int */ public function getLevel() { return $this->level; } /** * Set Level * * @param int $pValue Ranging 0 - 8 * @throws \Exception * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setLevel($pValue = 0) { if ($pValue < 0) { throw new \Exception("Invalid value should be more than 0."); } $this->level = $pValue; return $this; } /** * Get indent * * @return int */ public function getIndent() { return $this->indent; } /** * Set indent * * @param int $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setIndent($pValue = 0) { if ($pValue > 0 && !in_array($this->getHorizontal(), $this->supportedStyles)) { $pValue = 0; // indent not supported } $this->indent = $pValue; return $this; } /** * Get margin left * * @return int */ public function getMarginLeft() { return $this->marginLeft; } /** * Set margin left * * @param int $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setMarginLeft($pValue = 0) { if ($pValue > 0 && !in_array($this->getHorizontal(), $this->supportedStyles)) { $pValue = 0; // margin left not supported } $this->marginLeft = $pValue; return $this; } /** * Get margin right * * @return int */ public function getMarginRight() { return $this->marginRight; } /** * Set margin ight * * @param int $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setMarginRight($pValue = 0) { if ($pValue > 0 && !in_array($this->getHorizontal(), $this->supportedStyles)) { $pValue = 0; // margin right not supported } $this->marginRight = $pValue; return $this; } /** * Get margin top * * @return int */ public function getMarginTop() { return $this->marginTop; } /** * Set margin top * * @param int $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setMarginTop($pValue = 0) { $this->marginTop = $pValue; return $this; } /** * Get margin bottom * * @return int */ public function getMarginBottom() { return $this->marginBottom; } /** * Set margin bottom * * @param int $pValue * @return \PhpOffice\PhpPresentation\Style\Alignment */ public function setMarginBottom($pValue = 0) { $this->marginBottom = $pValue; return $this; } /** * @return string */ public function getTextDirection() { return $this->textDirection; } /** * @param string $pValue * @return Alignment */ public function setTextDirection($pValue = self::TEXT_DIRECTION_HORIZONTAL) { if (empty($pValue)) { $pValue = self::TEXT_DIRECTION_HORIZONTAL; } $this->textDirection = $pValue; return $this; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5( $this->horizontal . $this->vertical . $this->level . $this->indent . $this->marginLeft . $this->marginRight . __CLASS__ ); } /** * Get hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @return string Hash index */ public function getHashIndex() { return $this->hashIndex; } /** * Set hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @param string $value Hash index */ public function setHashIndex($value) { $this->hashIndex = $value; } }