Ejemplo n.º 1
0
 /**
  * Create a new \PhpOffice\PhpPowerpoint\Style\Borders
  */
 public function __construct()
 {
     // Initialise values
     $this->left = new Border();
     $this->right = new Border();
     $this->top = new Border();
     $this->bottom = new Border();
     $this->diagonalUp = new Border();
     $this->diagonalUp->setLineStyle(Border::LINE_NONE);
     $this->diagonalDown = new Border();
     $this->diagonalDown->setLineStyle(Border::LINE_NONE);
 }
Ejemplo n.º 2
0
 /**
  * Create a new self
  */
 public function __construct()
 {
     // Initialise values
     $this->slide = null;
     $this->offsetX = 0;
     $this->offsetY = 0;
     $this->width = 0;
     $this->height = 0;
     $this->rotation = 0;
     $this->fill = new Style\Fill();
     $this->border = new Style\Border();
     $this->shadow = new Style\Shadow();
     $this->border->setLineStyle(Style\Border::LINE_NONE);
 }
Ejemplo n.º 3
0
 /**
  * Write Border
  *
  * @param  \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter    XML Writer
  * @param  \PhpOffice\PhpPowerpoint\Style\Border     $pBorder      Border
  * @param  string                         $pElementName Element name
  * @throws \Exception
  */
 protected function writeBorder(XMLWriter $objWriter, Border $pBorder, $pElementName = 'L')
 {
     // Line style
     $lineStyle = $pBorder->getLineStyle();
     if ($lineStyle == Border::LINE_NONE) {
         $lineStyle = Border::LINE_SINGLE;
     }
     // Line width
     $lineWidth = 12700 * $pBorder->getLineWidth();
     // a:ln $pElementName
     $objWriter->startElement('a:ln' . $pElementName);
     $objWriter->writeAttribute('w', $lineWidth);
     $objWriter->writeAttribute('cap', 'flat');
     $objWriter->writeAttribute('cmpd', $lineStyle);
     $objWriter->writeAttribute('algn', 'ctr');
     // Fill?
     if ($pBorder->getLineStyle() == Border::LINE_NONE) {
         // a:noFill
         $objWriter->writeElement('a:noFill', null);
     } else {
         // a:solidFill
         $objWriter->startElement('a:solidFill');
         // a:srgbClr
         $objWriter->startElement('a:srgbClr');
         $objWriter->writeAttribute('val', $pBorder->getColor()->getRGB());
         $objWriter->endElement();
         $objWriter->endElement();
     }
     // Dash
     $objWriter->startElement('a:prstDash');
     $objWriter->writeAttribute('val', $pBorder->getDashStyle());
     $objWriter->endElement();
     // a:round
     $objWriter->writeElement('a:round', null);
     // a:headEnd
     $objWriter->startElement('a:headEnd');
     $objWriter->writeAttribute('type', 'none');
     $objWriter->writeAttribute('w', 'med');
     $objWriter->writeAttribute('len', 'med');
     $objWriter->endElement();
     // a:tailEnd
     $objWriter->startElement('a:tailEnd');
     $objWriter->writeAttribute('type', 'none');
     $objWriter->writeAttribute('w', 'med');
     $objWriter->writeAttribute('len', 'med');
     $objWriter->endElement();
     $objWriter->endElement();
 }
Ejemplo n.º 4
0
 /**
  * Get hash code
  *
  * @return string Hash code
  */
 public function getHashCode()
 {
     return md5($this->position . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->font->getHashCode() . $this->border->getHashCode() . $this->fill->getHashCode() . $this->alignment->getHashCode() . ($this->visible ? 't' : 'f') . __CLASS__);
 }
Ejemplo n.º 5
0
 /**
  * Test get/set line width
  */
 public function testSetGetLineWidth()
 {
     $object = new Border();
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineWidth());
     $this->assertEquals(1, $object->getLineWidth());
     $value = rand(1, 100);
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Border', $object->setLineWidth($value));
     $this->assertEquals($value, $object->getLineWidth());
 }