ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Worksheet_BaseDrawing Class Reference
+ Inheritance diagram for PHPExcel_Worksheet_BaseDrawing:
+ Collaboration diagram for PHPExcel_Worksheet_BaseDrawing:

Public Member Functions

 __construct ()
 Create a new PHPExcel_Worksheet_BaseDrawing.
 getImageIndex ()
 Get image index.
 getName ()
 Get Name.
 setName ($pValue= '')
 Set Name.
 getDescription ()
 Get Description.
 setDescription ($pValue= '')
 Set Description.
 getWorksheet ()
 Get Worksheet.
 setWorksheet (PHPExcel_Worksheet $pValue=null, $pOverrideOld=false)
 Set Worksheet.
 getCoordinates ()
 Get Coordinates.
 setCoordinates ($pValue= 'A1')
 Set Coordinates.
 getOffsetX ()
 Get OffsetX.
 setOffsetX ($pValue=0)
 Set OffsetX.
 getOffsetY ()
 Get OffsetY.
 setOffsetY ($pValue=0)
 Set OffsetY.
 getWidth ()
 Get Width.
 setWidth ($pValue=0)
 Set Width.
 getHeight ()
 Get Height.
 setHeight ($pValue=0)
 Set Height.
 setWidthAndHeight ($width=0, $height=0)
 Set width and height with proportional resize Example: $objDrawing->setResizeProportional(true); $objDrawing->setWidthAndHeight(160,120);
 getResizeProportional ()
 Get ResizeProportional.
 setResizeProportional ($pValue=true)
 Set ResizeProportional.
 getRotation ()
 Get Rotation.
 setRotation ($pValue=0)
 Set Rotation.
 getShadow ()
 Get Shadow.
 setShadow (PHPExcel_Worksheet_Drawing_Shadow $pValue=null)
 Set Shadow.
 getHashCode ()
 Get hash code.
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.

Protected Attributes

 $_name
 $_description
 $_worksheet
 $_coordinates
 $_offsetX
 $_offsetY
 $_width
 $_height
 $_resizeProportional
 $_rotation
 $_shadow

Private Attributes

 $_imageIndex = 0

Static Private Attributes

static $_imageCounter = 0

Detailed Description

Definition at line 36 of file BaseDrawing.php.

Constructor & Destructor Documentation

PHPExcel_Worksheet_BaseDrawing::__construct ( )

Create a new PHPExcel_Worksheet_BaseDrawing.

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing, PHPExcel_Worksheet_MemoryDrawing, and PHPExcel_Worksheet_Drawing.

Definition at line 132 of file BaseDrawing.php.

References $_imageCounter.

{
// Initialise values
$this->_name = '';
$this->_description = '';
$this->_worksheet = null;
$this->_coordinates = 'A1';
$this->_offsetX = 0;
$this->_offsetY = 0;
$this->_width = 0;
$this->_height = 0;
$this->_resizeProportional = true;
$this->_rotation = 0;
$this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow();
// Set image index
self::$_imageCounter++;
$this->_imageIndex = self::$_imageCounter;
}

Member Function Documentation

PHPExcel_Worksheet_BaseDrawing::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing, PHPExcel_Worksheet_MemoryDrawing, and PHPExcel_Worksheet_Drawing.

Definition at line 475 of file BaseDrawing.php.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
PHPExcel_Worksheet_BaseDrawing::getCoordinates ( )

Get Coordinates.

Returns
string

Definition at line 251 of file BaseDrawing.php.

References $_coordinates.

{
}
PHPExcel_Worksheet_BaseDrawing::getDescription ( )

Get Description.

Returns
string

Definition at line 186 of file BaseDrawing.php.

References $_description.

{
}
PHPExcel_Worksheet_BaseDrawing::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing, PHPExcel_Worksheet_MemoryDrawing, and PHPExcel_Worksheet_Drawing.

Definition at line 456 of file BaseDrawing.php.

Referenced by setWorksheet().

{
return md5(
$this->_name
. $this->_description
. $this->_worksheet->getHashCode()
. $this->_coordinates
. $this->_offsetX
. $this->_offsetY
. $this->_width
. $this->_height
. $this->_rotation
. $this->_shadow->getHashCode()
. __CLASS__
);
}

+ Here is the caller graph for this function:

PHPExcel_Worksheet_BaseDrawing::getHeight ( )

Get Height.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 339 of file BaseDrawing.php.

References $_height.

{
}
PHPExcel_Worksheet_BaseDrawing::getImageIndex ( )

Get image index.

Returns
int

Definition at line 157 of file BaseDrawing.php.

References $_imageIndex.

Referenced by PHPExcel_Worksheet_Drawing\getIndexedFilename(), and PHPExcel_Worksheet_MemoryDrawing\getIndexedFilename().

{
}

+ Here is the caller graph for this function:

PHPExcel_Worksheet_BaseDrawing::getName ( )

Get Name.

Returns
string

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 166 of file BaseDrawing.php.

References $_name.

{
return $this->_name;
}
PHPExcel_Worksheet_BaseDrawing::getOffsetX ( )

Get OffsetX.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 271 of file BaseDrawing.php.

References $_offsetX.

{
}
PHPExcel_Worksheet_BaseDrawing::getOffsetY ( )

Get OffsetY.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 291 of file BaseDrawing.php.

References $_offsetY.

{
}
PHPExcel_Worksheet_BaseDrawing::getResizeProportional ( )

Get ResizeProportional.

Returns
boolean

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 395 of file BaseDrawing.php.

References $_resizeProportional.

PHPExcel_Worksheet_BaseDrawing::getRotation ( )

Get Rotation.

Returns
int

Definition at line 415 of file BaseDrawing.php.

References $_rotation.

{
}
PHPExcel_Worksheet_BaseDrawing::getShadow ( )

Get Shadow.

Returns
PHPExcel_Worksheet_Drawing_Shadow

Definition at line 435 of file BaseDrawing.php.

References $_shadow.

{
}
PHPExcel_Worksheet_BaseDrawing::getWidth ( )

Get Width.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 311 of file BaseDrawing.php.

References $_width.

{
return $this->_width;
}
PHPExcel_Worksheet_BaseDrawing::getWorksheet ( )

Get Worksheet.

Returns
PHPExcel_Worksheet

Definition at line 206 of file BaseDrawing.php.

References $_worksheet.

{
}
PHPExcel_Worksheet_BaseDrawing::setCoordinates (   $pValue = 'A1')

Set Coordinates.

Parameters
string$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 261 of file BaseDrawing.php.

{
$this->_coordinates = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setDescription (   $pValue = '')

Set Description.

Parameters
string$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 196 of file BaseDrawing.php.

{
$this->_description = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setHeight (   $pValue = 0)

Set Height.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 349 of file BaseDrawing.php.

References $_height.

{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / $this->_height;
$this->_width = round($ratio * $pValue);
}
// Set height
$this->_height = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setName (   $pValue = '')

Set Name.

Parameters
string$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 176 of file BaseDrawing.php.

Referenced by PHPExcel_Reader_Excel2007\load().

{
$this->_name = $pValue;
return $this;
}

+ Here is the caller graph for this function:

PHPExcel_Worksheet_BaseDrawing::setOffsetX (   $pValue = 0)

Set OffsetX.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 281 of file BaseDrawing.php.

{
$this->_offsetX = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setOffsetY (   $pValue = 0)

Set OffsetY.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 301 of file BaseDrawing.php.

{
$this->_offsetY = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setResizeProportional (   $pValue = true)

Set ResizeProportional.

Parameters
boolean$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 405 of file BaseDrawing.php.

{
$this->_resizeProportional = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setRotation (   $pValue = 0)

Set Rotation.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 425 of file BaseDrawing.php.

{
$this->_rotation = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setShadow ( PHPExcel_Worksheet_Drawing_Shadow  $pValue = null)

Set Shadow.

Parameters
PHPExcel_Worksheet_Drawing_Shadow$pValue
Exceptions
Exception
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 446 of file BaseDrawing.php.

{
$this->_shadow = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setWidth (   $pValue = 0)

Set Width.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 321 of file BaseDrawing.php.

References $_width.

{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_height / $this->_width;
$this->_height = round($ratio * $pValue);
}
// Set width
$this->_width = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setWidthAndHeight (   $width = 0,
  $height = 0 
)

Set width and height with proportional resize Example: $objDrawing->setResizeProportional(true); $objDrawing->setWidthAndHeight(160,120);

Author
Vincent MSN:kele_.nosp@m.100@.nosp@m.hotma.nosp@m.il.c.nosp@m.om
Parameters
int$width
int$height
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 375 of file BaseDrawing.php.

References $_height, and $_width.

{
$xratio = $width / $this->_width;
$yratio = $height / $this->_height;
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
if (($xratio * $this->_height) < $height) {
$this->_height = ceil($xratio * $this->_height);
$this->_width = $width;
} else {
$this->_width = ceil($yratio * $this->_width);
$this->_height = $height;
}
}
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setWorksheet ( PHPExcel_Worksheet  $pValue = null,
  $pOverrideOld = false 
)

Set Worksheet.

Parameters
PHPExcel_Worksheet$pValue
bool$pOverrideOldIf a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
Exceptions
Exception
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 218 of file BaseDrawing.php.

References getHashCode().

{
if (is_null($this->_worksheet)) {
// Add drawing to PHPExcel_Worksheet
$this->_worksheet = $pValue;
$this->_worksheet->getCell($this->_coordinates);
$this->_worksheet->getDrawingCollection()->append($this);
} else {
if ($pOverrideOld) {
// Remove drawing from old PHPExcel_Worksheet
$iterator = $this->_worksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
$this->_worksheet = null;
break;
}
}
// Set new PHPExcel_Worksheet
$this->setWorksheet($pValue);
} else {
throw new Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
}
}
return $this;
}

+ Here is the call graph for this function:

Field Documentation

PHPExcel_Worksheet_BaseDrawing::$_coordinates
protected

Definition at line 78 of file BaseDrawing.php.

Referenced by getCoordinates().

PHPExcel_Worksheet_BaseDrawing::$_description
protected

Definition at line 64 of file BaseDrawing.php.

Referenced by getDescription().

PHPExcel_Worksheet_BaseDrawing::$_height
protected

Definition at line 106 of file BaseDrawing.php.

Referenced by getHeight(), setHeight(), and setWidthAndHeight().

PHPExcel_Worksheet_BaseDrawing::$_imageCounter = 0
staticprivate

Definition at line 43 of file BaseDrawing.php.

Referenced by __construct().

PHPExcel_Worksheet_BaseDrawing::$_imageIndex = 0
private

Definition at line 50 of file BaseDrawing.php.

Referenced by getImageIndex().

PHPExcel_Worksheet_BaseDrawing::$_name
protected

Definition at line 57 of file BaseDrawing.php.

Referenced by getName().

PHPExcel_Worksheet_BaseDrawing::$_offsetX
protected

Definition at line 85 of file BaseDrawing.php.

Referenced by getOffsetX().

PHPExcel_Worksheet_BaseDrawing::$_offsetY
protected

Definition at line 92 of file BaseDrawing.php.

Referenced by getOffsetY().

PHPExcel_Worksheet_BaseDrawing::$_resizeProportional
protected

Definition at line 113 of file BaseDrawing.php.

Referenced by getResizeProportional().

PHPExcel_Worksheet_BaseDrawing::$_rotation
protected

Definition at line 120 of file BaseDrawing.php.

Referenced by getRotation().

PHPExcel_Worksheet_BaseDrawing::$_shadow
protected

Definition at line 127 of file BaseDrawing.php.

Referenced by getShadow().

PHPExcel_Worksheet_BaseDrawing::$_width
protected

Definition at line 99 of file BaseDrawing.php.

Referenced by getWidth(), setWidth(), and setWidthAndHeight().

PHPExcel_Worksheet_BaseDrawing::$_worksheet
protected

Definition at line 71 of file BaseDrawing.php.

Referenced by getWorksheet().


The documentation for this class was generated from the following file: