ILIAS  Release_4_0_x_branch Revision 61816
 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.
 getHashIndex ()
 Get hash index.
 setHashIndex ($value)
 Set hash index.
 __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
 $_hashIndex

Static Private Attributes

static $_imageCounter = 0

Detailed Description

Definition at line 53 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 149 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 523 of file BaseDrawing.php.

References $key.

{
$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 268 of file BaseDrawing.php.

References $_coordinates.

{
}
PHPExcel_Worksheet_BaseDrawing::getDescription ( )

Get Description.

Returns
string

Definition at line 203 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 473 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::getHashIndex ( )

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.

Returns
string Hash index

Implements PHPExcel_IComparable.

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing, PHPExcel_Worksheet_MemoryDrawing, and PHPExcel_Worksheet_Drawing.

Definition at line 504 of file BaseDrawing.php.

References $_hashIndex.

{
}
PHPExcel_Worksheet_BaseDrawing::getHeight ( )

Get Height.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 356 of file BaseDrawing.php.

References $_height.

{
}
PHPExcel_Worksheet_BaseDrawing::getImageIndex ( )

Get image index.

Returns
int

Definition at line 174 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 183 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 288 of file BaseDrawing.php.

References $_offsetX.

{
}
PHPExcel_Worksheet_BaseDrawing::getOffsetY ( )

Get OffsetY.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 308 of file BaseDrawing.php.

References $_offsetY.

{
}
PHPExcel_Worksheet_BaseDrawing::getResizeProportional ( )

Get ResizeProportional.

Returns
boolean

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 412 of file BaseDrawing.php.

References $_resizeProportional.

PHPExcel_Worksheet_BaseDrawing::getRotation ( )

Get Rotation.

Returns
int

Definition at line 432 of file BaseDrawing.php.

References $_rotation.

{
}
PHPExcel_Worksheet_BaseDrawing::getShadow ( )

Get Shadow.

Returns
PHPExcel_Worksheet_Drawing_Shadow

Definition at line 452 of file BaseDrawing.php.

References $_shadow.

{
}
PHPExcel_Worksheet_BaseDrawing::getWidth ( )

Get Width.

Returns
int

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 328 of file BaseDrawing.php.

References $_width.

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

Get Worksheet.

Returns
PHPExcel_Worksheet

Definition at line 223 of file BaseDrawing.php.

References $_worksheet.

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

Set Coordinates.

Parameters
string$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Definition at line 278 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 213 of file BaseDrawing.php.

{
$this->_description = $pValue;
return $this;
}
PHPExcel_Worksheet_BaseDrawing::setHashIndex (   $value)

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.

Parameters
string$valueHash index

Implements PHPExcel_IComparable.

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing, PHPExcel_Worksheet_MemoryDrawing, and PHPExcel_Worksheet_Drawing.

Definition at line 516 of file BaseDrawing.php.

{
$this->_hashIndex = $value;
}
PHPExcel_Worksheet_BaseDrawing::setHeight (   $pValue = 0)

Set Height.

Parameters
int$pValue
Returns
PHPExcel_Worksheet_BaseDrawing

Reimplemented in PHPExcel_Worksheet_HeaderFooterDrawing.

Definition at line 366 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 193 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 298 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 318 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 422 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 442 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 463 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 338 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 392 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 235 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 95 of file BaseDrawing.php.

Referenced by getCoordinates().

PHPExcel_Worksheet_BaseDrawing::$_description
protected

Definition at line 81 of file BaseDrawing.php.

Referenced by getDescription().

PHPExcel_Worksheet_BaseDrawing::$_hashIndex
private

Definition at line 494 of file BaseDrawing.php.

Referenced by getHashIndex().

PHPExcel_Worksheet_BaseDrawing::$_height
protected

Definition at line 123 of file BaseDrawing.php.

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

PHPExcel_Worksheet_BaseDrawing::$_imageCounter = 0
staticprivate

Definition at line 60 of file BaseDrawing.php.

Referenced by __construct().

PHPExcel_Worksheet_BaseDrawing::$_imageIndex = 0
private

Definition at line 67 of file BaseDrawing.php.

Referenced by getImageIndex().

PHPExcel_Worksheet_BaseDrawing::$_name
protected

Definition at line 74 of file BaseDrawing.php.

Referenced by getName().

PHPExcel_Worksheet_BaseDrawing::$_offsetX
protected

Definition at line 102 of file BaseDrawing.php.

Referenced by getOffsetX().

PHPExcel_Worksheet_BaseDrawing::$_offsetY
protected

Definition at line 109 of file BaseDrawing.php.

Referenced by getOffsetY().

PHPExcel_Worksheet_BaseDrawing::$_resizeProportional
protected

Definition at line 130 of file BaseDrawing.php.

Referenced by getResizeProportional().

PHPExcel_Worksheet_BaseDrawing::$_rotation
protected

Definition at line 137 of file BaseDrawing.php.

Referenced by getRotation().

PHPExcel_Worksheet_BaseDrawing::$_shadow
protected

Definition at line 144 of file BaseDrawing.php.

Referenced by getShadow().

PHPExcel_Worksheet_BaseDrawing::$_width
protected

Definition at line 116 of file BaseDrawing.php.

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

PHPExcel_Worksheet_BaseDrawing::$_worksheet
protected

Definition at line 88 of file BaseDrawing.php.

Referenced by getWorksheet().


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