Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;
   4  
   5  use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;
   6  
   7  class SpContainer
   8  {
   9      /**
  10       * Parent Shape Group Container.
  11       *
  12       * @var SpgrContainer
  13       */
  14      private $parent;
  15  
  16      /**
  17       * Is this a group shape?
  18       *
  19       * @var bool
  20       */
  21      private $spgr = false;
  22  
  23      /**
  24       * Shape type.
  25       *
  26       * @var int
  27       */
  28      private $spType;
  29  
  30      /**
  31       * Shape flag.
  32       *
  33       * @var int
  34       */
  35      private $spFlag;
  36  
  37      /**
  38       * Shape index (usually group shape has index 0, and the rest: 1,2,3...).
  39       *
  40       * @var int
  41       */
  42      private $spId;
  43  
  44      /**
  45       * Array of options.
  46       *
  47       * @var array
  48       */
  49      private $OPT;
  50  
  51      /**
  52       * Cell coordinates of upper-left corner of shape, e.g. 'A1'.
  53       *
  54       * @var string
  55       */
  56      private $startCoordinates;
  57  
  58      /**
  59       * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width.
  60       *
  61       * @var int
  62       */
  63      private $startOffsetX;
  64  
  65      /**
  66       * Vertical offset of upper-left corner of shape measured in 1/256 of row height.
  67       *
  68       * @var int
  69       */
  70      private $startOffsetY;
  71  
  72      /**
  73       * Cell coordinates of bottom-right corner of shape, e.g. 'B2'.
  74       *
  75       * @var string
  76       */
  77      private $endCoordinates;
  78  
  79      /**
  80       * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width.
  81       *
  82       * @var int
  83       */
  84      private $endOffsetX;
  85  
  86      /**
  87       * Vertical offset of bottom-right corner of shape measured in 1/256 of row height.
  88       *
  89       * @var int
  90       */
  91      private $endOffsetY;
  92  
  93      /**
  94       * Set parent Shape Group Container.
  95       *
  96       * @param SpgrContainer $parent
  97       */
  98      public function setParent($parent)
  99      {
 100          $this->parent = $parent;
 101      }
 102  
 103      /**
 104       * Get the parent Shape Group Container.
 105       *
 106       * @return SpgrContainer
 107       */
 108      public function getParent()
 109      {
 110          return $this->parent;
 111      }
 112  
 113      /**
 114       * Set whether this is a group shape.
 115       *
 116       * @param bool $value
 117       */
 118      public function setSpgr($value)
 119      {
 120          $this->spgr = $value;
 121      }
 122  
 123      /**
 124       * Get whether this is a group shape.
 125       *
 126       * @return bool
 127       */
 128      public function getSpgr()
 129      {
 130          return $this->spgr;
 131      }
 132  
 133      /**
 134       * Set the shape type.
 135       *
 136       * @param int $value
 137       */
 138      public function setSpType($value)
 139      {
 140          $this->spType = $value;
 141      }
 142  
 143      /**
 144       * Get the shape type.
 145       *
 146       * @return int
 147       */
 148      public function getSpType()
 149      {
 150          return $this->spType;
 151      }
 152  
 153      /**
 154       * Set the shape flag.
 155       *
 156       * @param int $value
 157       */
 158      public function setSpFlag($value)
 159      {
 160          $this->spFlag = $value;
 161      }
 162  
 163      /**
 164       * Get the shape flag.
 165       *
 166       * @return int
 167       */
 168      public function getSpFlag()
 169      {
 170          return $this->spFlag;
 171      }
 172  
 173      /**
 174       * Set the shape index.
 175       *
 176       * @param int $value
 177       */
 178      public function setSpId($value)
 179      {
 180          $this->spId = $value;
 181      }
 182  
 183      /**
 184       * Get the shape index.
 185       *
 186       * @return int
 187       */
 188      public function getSpId()
 189      {
 190          return $this->spId;
 191      }
 192  
 193      /**
 194       * Set an option for the Shape Group Container.
 195       *
 196       * @param int $property The number specifies the option
 197       * @param mixed $value
 198       */
 199      public function setOPT($property, $value)
 200      {
 201          $this->OPT[$property] = $value;
 202      }
 203  
 204      /**
 205       * Get an option for the Shape Group Container.
 206       *
 207       * @param int $property The number specifies the option
 208       *
 209       * @return mixed
 210       */
 211      public function getOPT($property)
 212      {
 213          if (isset($this->OPT[$property])) {
 214              return $this->OPT[$property];
 215          }
 216  
 217          return null;
 218      }
 219  
 220      /**
 221       * Get the collection of options.
 222       *
 223       * @return array
 224       */
 225      public function getOPTCollection()
 226      {
 227          return $this->OPT;
 228      }
 229  
 230      /**
 231       * Set cell coordinates of upper-left corner of shape.
 232       *
 233       * @param string $value eg: 'A1'
 234       */
 235      public function setStartCoordinates($value)
 236      {
 237          $this->startCoordinates = $value;
 238      }
 239  
 240      /**
 241       * Get cell coordinates of upper-left corner of shape.
 242       *
 243       * @return string
 244       */
 245      public function getStartCoordinates()
 246      {
 247          return $this->startCoordinates;
 248      }
 249  
 250      /**
 251       * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width.
 252       *
 253       * @param int $startOffsetX
 254       */
 255      public function setStartOffsetX($startOffsetX)
 256      {
 257          $this->startOffsetX = $startOffsetX;
 258      }
 259  
 260      /**
 261       * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width.
 262       *
 263       * @return int
 264       */
 265      public function getStartOffsetX()
 266      {
 267          return $this->startOffsetX;
 268      }
 269  
 270      /**
 271       * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height.
 272       *
 273       * @param int $startOffsetY
 274       */
 275      public function setStartOffsetY($startOffsetY)
 276      {
 277          $this->startOffsetY = $startOffsetY;
 278      }
 279  
 280      /**
 281       * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height.
 282       *
 283       * @return int
 284       */
 285      public function getStartOffsetY()
 286      {
 287          return $this->startOffsetY;
 288      }
 289  
 290      /**
 291       * Set cell coordinates of bottom-right corner of shape.
 292       *
 293       * @param string $value eg: 'A1'
 294       */
 295      public function setEndCoordinates($value)
 296      {
 297          $this->endCoordinates = $value;
 298      }
 299  
 300      /**
 301       * Get cell coordinates of bottom-right corner of shape.
 302       *
 303       * @return string
 304       */
 305      public function getEndCoordinates()
 306      {
 307          return $this->endCoordinates;
 308      }
 309  
 310      /**
 311       * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width.
 312       *
 313       * @param int $endOffsetX
 314       */
 315      public function setEndOffsetX($endOffsetX)
 316      {
 317          $this->endOffsetX = $endOffsetX;
 318      }
 319  
 320      /**
 321       * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width.
 322       *
 323       * @return int
 324       */
 325      public function getEndOffsetX()
 326      {
 327          return $this->endOffsetX;
 328      }
 329  
 330      /**
 331       * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height.
 332       *
 333       * @param int $endOffsetY
 334       */
 335      public function setEndOffsetY($endOffsetY)
 336      {
 337          $this->endOffsetY = $endOffsetY;
 338      }
 339  
 340      /**
 341       * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height.
 342       *
 343       * @return int
 344       */
 345      public function getEndOffsetY()
 346      {
 347          return $this->endOffsetY;
 348      }
 349  
 350      /**
 351       * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
 352       * the dgContainer. A value of 1 = immediately within first spgrContainer
 353       * Higher nesting level occurs if and only if spContainer is part of a shape group.
 354       *
 355       * @return int Nesting level
 356       */
 357      public function getNestingLevel()
 358      {
 359          $nestingLevel = 0;
 360  
 361          $parent = $this->getParent();
 362          while ($parent instanceof SpgrContainer) {
 363              ++$nestingLevel;
 364              $parent = $parent->getParent();
 365          }
 366  
 367          return $nestingLevel;
 368      }
 369  }