コード例 #1
0
 public function testCreateProperty()
 {
     $gen = new ezcDocumentOdtStyleParagraphPropertyGenerator($this->styleConverters);
     $parent = $this->getDomElementFixture();
     $gen->createProperty($parent, array('text-align' => new ezcDocumentPcssStyleStringValue('center')));
     $this->assertPropertyExists(ezcDocumentOdt::NS_ODT_STYLE, 'paragraph-properties', array(array(ezcDocumentOdt::NS_ODT_FO, 'text-align')), $parent);
 }
コード例 #2
0
ファイル: table_cell.php プロジェクト: bmdevel/ezc
 /**
  * Creates the styles with $styleAttributes for the given $odtElement.
  * 
  * @param ezcDocumentOdtStyleInformation $styleInfo 
  * @param DOMElement $odtElement 
  * @param array $styleAttributes 
  */
 public function createStyle(ezcDocumentOdtStyleInformation $styleInfo, DOMElement $odtElement, array $styleAttributes)
 {
     $styleName = $this->getUniqueStyleName($odtElement->localName);
     $style = $styleInfo->automaticStyleSection->appendChild($styleInfo->automaticStyleSection->ownerDocument->createElementNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:style'));
     $style->setAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:family', 'table-cell');
     $style->setAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:name', $styleName);
     $odtElement->setAttributeNS(ezcDocumentOdt::NS_ODT_TABLE, 'table:style-name', $styleName);
     $this->tableCellPropertyGenerator->createProperty($style, $styleAttributes);
     $this->paragraphPropertyGenerator->createProperty($style, $styleAttributes);
 }
コード例 #3
0
ファイル: paragraph.php プロジェクト: bmdevel/ezc
 /**
  * Creates the styles with $styleAttributes for the given $odtElement.
  * 
  * @param ezcDocumentOdtStyleInformation $styleInfo 
  * @param DOMElement $odtElement 
  * @param array $styleAttributes 
  */
 public function createStyle(ezcDocumentOdtStyleInformation $styleInfo, DOMElement $odtElement, array $styleAttributes)
 {
     $styleName = $this->getUniqueStyleName($odtElement->localName);
     $style = $styleInfo->automaticStyleSection->appendChild($styleInfo->automaticStyleSection->ownerDocument->createElementNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:style'));
     $style->setAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:family', 'paragraph');
     $style->setAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'style:name', $styleName);
     $odtElement->setAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'text:style-name', $styleName);
     // Setting the margins in a list contained paragraph results in
     // overwriting the list margin. Therefore we skip paragraph property
     // generation completely here.
     // @TODO: Does this have any strange effects? Find a nicer solution?
     if ($odtElement->parentNode->localName !== 'list-item') {
         $this->paragraphPropertyGenerator->createProperty($style, $styleAttributes);
     }
     $this->textPropertyGenerator->createProperty($style, $styleAttributes);
 }