Ejemplo n.º 1
0
 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'orderedlist');
     $types = array('a' => 'loweralpha', 'A' => 'upperalpha', 'i' => 'lowerroman', 'I' => 'upperroman');
     if ($element->hasAttribute('type') && isset($types[$type = $element->getAttribute('type')])) {
         $element->setProperty('attributes', array('numeration' => $types[$type]));
     }
 }
Ejemplo n.º 2
0
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $parent = $element->parentNode;
     if ($parent->namespaceURI === ezcDocumentOdt::NS_ODT_TEXT && $parent->localName === 'p') {
         $element->setProperty('type', 'inlinemediaobject');
     } else {
         $element->setProperty('type', 'mediaobject');
     }
 }
Ejemplo n.º 3
0
 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     if ($element->tagName === 'p') {
         $element->setProperty('type', 'literallayout');
         $element->setProperty('attributes', array('class' => 'normal'));
     } else {
         $element->appendChild(new DOMText("\n"));
         $element->setProperty('whitespace', 'significant');
     }
 }
Ejemplo n.º 4
0
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'ulink');
     $attrs = $element->getProperty('attributes');
     if (!is_array($attrs)) {
         $attrs = array();
     }
     // @todo: Can we convert more attributes here? Maybe <ulink type="…"/>?
     $attrs['url'] = $element->getAttributeNS(ezcDocumentOdt::NS_XLINK, 'href');
     $element->setProperty('attributes', $attrs);
 }
Ejemplo n.º 5
0
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'footnote');
     $citations = $element->getElementsByTagNameNS(ezcDocumentOdt::NS_ODT_TEXT, 'note-citation');
     // Should be only 1, foreach to remove all
     foreach ($citations as $cite) {
         $attrs = $element->getProperty('attributes');
         if ($attrs === false) {
             $attrs = array();
         }
         $attrs['label'] = $cite->nodeValue;
         $element->setProperty('attributes', $attrs);
         $element->removeChild($cite);
     }
 }
Ejemplo n.º 6
0
 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     // Only decorate non-empty paragraphs
     if (trim($element->textContent) && $element->getProperty('type') === false) {
         $element->setProperty('type', 'para');
     }
 }
Ejemplo n.º 7
0
 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     if ($element->hasAttribute('rowspan') && $element->getAttribute('rowspan') > 1) {
         $attributes = $element->getProperty('attributes');
         $attributes['morerows'] = $element->getAttribute('rowspan') - 1;
         $element->setProperty('attributes', $attributes);
     }
     // @todo: Handle colspan, too - even it is quite complex to express in
     // docbook.
 }
Ejemplo n.º 8
0
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $frame = $element->parentNode;
     $element->setProperty('type', 'imageobject');
     $imageData = new ezcDocumentPropertyContainerDomElement('imagedata', null, ezcDocumentOdt::NS_EZC);
     $this->insertImageData($element, $imageData);
     $imageData->setProperty('type', 'imagedata');
     $attributes = array('fileref' => $element->getAttributeNS(ezcDocumentOdt::NS_XLINK, 'href'));
     if ($frame->hasAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'width')) {
         $attributes['width'] = $frame->getAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'width');
     }
     if ($frame->hasAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'height')) {
         $attributes['depth'] = $frame->getAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'height');
     }
     $imageData->setProperty('attributes', $attributes);
 }
Ejemplo n.º 9
0
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $spaces = '';
     switch ($element->localName) {
         case 's':
             $count = $element->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'c');
             $spaces = str_repeat(' ', $count !== '' ? (int) $count : 1);
             break;
         case 'tab':
             $spaces = "\t";
             break;
         case 'line-break':
             $spaces = "\n";
             break;
     }
     $element->setProperty('spaces', $spaces);
 }
Ejemplo n.º 10
0
 /**
  * Filter meta data
  *
  * Filter meta elements in HTML header for relevant metadata.
  * 
  * @param DOMElement $element
  * @return void
  */
 protected function filterMetaData(DOMElement $element)
 {
     if ($element->hasAttribute('name') && $element->hasAttribute('content') && ($name = strtolower($element->getAttribute('name'))) && isset($this->mapping[$name])) {
         // Set type of element
         $element->setProperty('type', $this->mapping[$name]);
         // Apply special parsing and conversion to some of the given
         // elements
         switch ($this->mapping[$name]) {
             case 'abstract':
                 $textNode = $element->ownerDocument->createElement('span');
                 $textNode->setProperty('type', 'para');
                 $element->appendChild($textNode);
                 break;
             default:
                 $textNode = $element;
         }
         // Set conents as child text node.
         $text = new DOMText($element->getAttribute('content'));
         $textNode->appendChild($text);
     }
 }
Ejemplo n.º 11
0
 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', $this->nameMapping[$element->tagName]);
 }
Ejemplo n.º 12
0
 /**
  * Sets properties of itemized lists based on $listLevelProps.
  * 
  * @param DOMElement $itemList 
  * @param ezcDocumentOdtListLevelStyleBullet $listLevelProps 
  */
 protected function setItemListProperties(DOMElement $itemList, ezcDocumentOdtListLevelStyleBullet $listLevelProps)
 {
     $itemList->setProperty('type', 'itemizedlist');
 }
Ejemplo n.º 13
0
 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('whitespace', 'significant');
     $element->setProperty('type', $this->isInline($element) ? 'literal' : 'literallayout');
 }
Ejemplo n.º 14
0
 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'emphasis');
     $element->setProperty('attributes', array('Role' => 'strong'));
 }
Ejemplo n.º 15
0
 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'literallayout');
     $element->setProperty('attributes', array('class' => 'normal'));
 }
Ejemplo n.º 16
0
Archivo: list.php Proyecto: bmdevel/ezc
 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', $this->mapping[$element->localName]);
 }