Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Worksheet;
   4  
   5  use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
   6  
   7  abstract class Dimension
   8  {
   9      /**
  10       * Visible?
  11       *
  12       * @var bool
  13       */
  14      private $visible = true;
  15  
  16      /**
  17       * Outline level.
  18       *
  19       * @var int
  20       */
  21      private $outlineLevel = 0;
  22  
  23      /**
  24       * Collapsed.
  25       *
  26       * @var bool
  27       */
  28      private $collapsed = false;
  29  
  30      /**
  31       * Index to cellXf. Null value means row has no explicit cellXf format.
  32       *
  33       * @var null|int
  34       */
  35      private $xfIndex;
  36  
  37      /**
  38       * Create a new Dimension.
  39       *
  40       * @param int $initialValue Numeric row index
  41       */
  42      public function __construct($initialValue = null)
  43      {
  44          // set dimension as unformatted by default
  45          $this->xfIndex = $initialValue;
  46      }
  47  
  48      /**
  49       * Get Visible.
  50       */
  51      public function getVisible(): bool
  52      {
  53          return $this->visible;
  54      }
  55  
  56      /**
  57       * Set Visible.
  58       *
  59       * @return $this
  60       */
  61      public function setVisible(bool $visible)
  62      {
  63          $this->visible = $visible;
  64  
  65          return $this;
  66      }
  67  
  68      /**
  69       * Get Outline Level.
  70       */
  71      public function getOutlineLevel(): int
  72      {
  73          return $this->outlineLevel;
  74      }
  75  
  76      /**
  77       * Set Outline Level.
  78       * Value must be between 0 and 7.
  79       *
  80       * @return $this
  81       */
  82      public function setOutlineLevel(int $level)
  83      {
  84          if ($level < 0 || $level > 7) {
  85              throw new PhpSpreadsheetException('Outline level must range between 0 and 7.');
  86          }
  87  
  88          $this->outlineLevel = $level;
  89  
  90          return $this;
  91      }
  92  
  93      /**
  94       * Get Collapsed.
  95       */
  96      public function getCollapsed(): bool
  97      {
  98          return $this->collapsed;
  99      }
 100  
 101      /**
 102       * Set Collapsed.
 103       *
 104       * @return $this
 105       */
 106      public function setCollapsed(bool $collapsed)
 107      {
 108          $this->collapsed = $collapsed;
 109  
 110          return $this;
 111      }
 112  
 113      /**
 114       * Get index to cellXf.
 115       *
 116       * @return int
 117       */
 118      public function getXfIndex(): ?int
 119      {
 120          return $this->xfIndex;
 121      }
 122  
 123      /**
 124       * Set index to cellXf.
 125       *
 126       * @return $this
 127       */
 128      public function setXfIndex(int $XfIndex)
 129      {
 130          $this->xfIndex = $XfIndex;
 131  
 132          return $this;
 133      }
 134  }