ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_RichText Class Reference
+ Inheritance diagram for PHPExcel_RichText:
+ Collaboration diagram for PHPExcel_RichText:

Public Member Functions

 __construct (PHPExcel_Cell $pCell=null)
 Create a new PHPExcel_RichText instance.
 addText (PHPExcel_RichText_ITextElement $pText=null)
 Add text.
 createText ($pText= '')
 Create text.
 createTextRun ($pText= '')
 Create text run.
 getPlainText ()
 Get plain text.
 __toString ()
 Convert to string.
 getRichTextElements ()
 Get Rich Text elements.
 setRichTextElements ($pElements=null)
 Set Rich Text elements.
 getParent ()
 Get parent.
 setParent (PHPExcel_Cell $value)
 Set parent.
 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.

Private Attributes

 $_richTextElements
 $_parent
 $_hashIndex

Detailed Description

Definition at line 65 of file RichText.php.

Constructor & Destructor Documentation

PHPExcel_RichText::__construct ( PHPExcel_Cell  $pCell = null)

Create a new PHPExcel_RichText instance.

Parameters
PHPExcel_Cell$pParent
Exceptions
Exception

Definition at line 87 of file RichText.php.

References addText(), PHPExcel_RichText_Run\setFont(), and PHPExcel_Cell_DataType\TYPE_STRING.

{
// Initialise variables
$this->_richTextElements = array();
// Set parent?
if (!is_null($pCell)) {
// Set parent cell
$this->_parent = $pCell;
// Add cell text and style
if ($this->_parent->getValue() != "") {
$objRun = new PHPExcel_RichText_Run($this->_parent->getValue());
$objRun->setFont(clone $this->_parent->getParent()->getStyle($this->_parent->getCoordinate())->getFont());
$this->addText($objRun);
}
// Set parent value
$this->_parent->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING);
}
}

+ Here is the call graph for this function:

Member Function Documentation

PHPExcel_RichText::__clone ( )

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

Definition at line 294 of file RichText.php.

References $key.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ($key == '_parent') continue;
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
PHPExcel_RichText::__toString ( )

Convert to string.

Returns
string

Definition at line 174 of file RichText.php.

References getPlainText().

{
return $this->getPlainText();
}

+ Here is the call graph for this function:

PHPExcel_RichText::addText ( PHPExcel_RichText_ITextElement  $pText = null)

Add text.

Parameters
PHPExcel_RichText_ITextElement$pTextRich text element
Exceptions
Exception
Returns
PHPExcel_RichText

Definition at line 116 of file RichText.php.

Referenced by __construct(), createText(), and createTextRun().

{
$this->_richTextElements[] = $pText;
return $this;
}

+ Here is the caller graph for this function:

PHPExcel_RichText::createText (   $pText = '')

Create text.

Parameters
string$pTextText
Returns
PHPExcel_RichText_TextElement
Exceptions
Exception

Definition at line 129 of file RichText.php.

References addText().

{
$objText = new PHPExcel_RichText_TextElement($pText);
$this->addText($objText);
return $objText;
}

+ Here is the call graph for this function:

PHPExcel_RichText::createTextRun (   $pText = '')

Create text run.

Parameters
string$pTextText
Returns
PHPExcel_RichText_Run
Exceptions
Exception

Definition at line 143 of file RichText.php.

References addText().

{
$objText = new PHPExcel_RichText_Run($pText);
$this->addText($objText);
return $objText;
}

+ Here is the call graph for this function:

PHPExcel_RichText::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 248 of file RichText.php.

{
$hashElements = '';
foreach ($this->_richTextElements as $element) {
$hashElements .= $element->getHashCode();
}
return md5(
$hashElements
. __CLASS__
);
}
PHPExcel_RichText::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.

Definition at line 275 of file RichText.php.

References $_hashIndex.

{
}
PHPExcel_RichText::getParent ( )

Get parent.

Returns
PHPExcel_Cell

Definition at line 210 of file RichText.php.

References $_parent.

{
}
PHPExcel_RichText::getPlainText ( )

Get plain text.

Returns
string

Definition at line 155 of file RichText.php.

Referenced by __toString().

{
// Return value
$returnValue = '';
// Loop trough all PHPExcel_RichText_ITextElement
foreach ($this->_richTextElements as $text) {
$returnValue .= $text->getText();
}
// Return
return $returnValue;
}

+ Here is the caller graph for this function:

PHPExcel_RichText::getRichTextElements ( )

Get Rich Text elements.

Returns
PHPExcel_RichText_ITextElement[]

Definition at line 183 of file RichText.php.

References $_richTextElements.

Referenced by setParent().

+ Here is the caller graph for this function:

PHPExcel_RichText::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.

Definition at line 287 of file RichText.php.

{
$this->_hashIndex = $value;
}
PHPExcel_RichText::setParent ( PHPExcel_Cell  $value)

Set parent.

Parameters
PHPExcel_Cell$value
Returns
PHPExcel_RichText

Definition at line 220 of file RichText.php.

References getRichTextElements(), PHPExcel_Cell\setValueExplicit(), and PHPExcel_Cell_DataType\TYPE_STRING.

{
// Set parent
$this->_parent = $value;
// Set parent value
// Verify style information
$sheet = $this->_parent->getParent();
$cellFont = $sheet->getStyle($this->_parent->getCoordinate())->getFont()->getSharedComponent();
foreach ($this->getRichTextElements() as $element) {
if (!($element instanceof PHPExcel_RichText_Run)) continue;
if ($element->getFont()->getHashCode() == $sheet->getDefaultStyle()->getFont()->getHashCode()) {
if ($element->getFont()->getHashCode() != $cellFont->getHashCode()) {
$element->setFont(clone $cellFont);
}
}
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_RichText::setRichTextElements (   $pElements = null)

Set Rich Text elements.

Parameters
PHPExcel_RichText_ITextElement[]$pElements Array of elements
Exceptions
Exception
Returns
PHPExcel_RichText

Definition at line 195 of file RichText.php.

{
if (is_array($pElements)) {
$this->_richTextElements = $pElements;
} else {
throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
}
return $this;
}

Field Documentation

PHPExcel_RichText::$_hashIndex
private

Definition at line 265 of file RichText.php.

Referenced by getHashIndex().

PHPExcel_RichText::$_parent
private

Definition at line 79 of file RichText.php.

Referenced by getParent().

PHPExcel_RichText::$_richTextElements
private

Definition at line 72 of file RichText.php.

Referenced by getRichTextElements().


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