<?php
/**
 * Created by PhpStorm.
 * User: phperstar
 * Date: 2020/8/11
 * Time: 10:28 AM
 */
namespace Util\PHPExcel;

class Style
{

    /**
     * Index of style in collection. Only used for real style.
     *
     * @var int
     */
    protected $index;

    /**
     * Create a new PHPExcel_Style
     *
     * @param boolean $isSupervisor Flag indicating if this is a supervisor or not
     *         Leave this value at default unless you understand exactly what
     *    its ramifications are
     * @param boolean $isConditional Flag indicating if this is a conditional style or not
     *       Leave this value at default unless you understand exactly what
     *    its ramifications are
     */
    public function __construct($isSupervisor = false, $isConditional = false)
    {
        // Supervisor?
        $this->isSupervisor = $isSupervisor;

        // Initialise values
        $this->conditionalStyles = array();
        /*$this->font         = new PHPExcel_Style_Font($isSupervisor, $isConditional);
        $this->fill         = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
        $this->borders      = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
        $this->alignment    = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
        $this->numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
        $this->protection   = new PHPExcel_Style_Protection($isSupervisor, $isConditional); */

        // bind parent if we are a supervisor
        if ($isSupervisor) {
            $this->font->bindParent($this);
            $this->fill->bindParent($this);
            $this->borders->bindParent($this);
            $this->alignment->bindParent($this);
            $this->numberFormat->bindParent($this);
            $this->protection->bindParent($this);
        }
    }

    /**
     * Set own index in style collection
     *
     * @param int $pValue
     */
    public function setIndex($pValue)
    {
        $this->index = $pValue;
    }
}