예제 #1
0
 /**
  * Detects emphasis elements by their style.
  *
  * This method checks the style of the given $odtElement for bold 
  * font-weight ("bold" or value >= 700). If this is detected, the type of 
  * the element is set to be <emphasis/>.
  * 
  * @param DOMElement $odtElement 
  * @param ezcDocumentOdtStyleInferencer $styleInferencer
  */
 public function filter(DOMElement $odtElement, ezcDocumentOdtStyleInferencer $styleInferencer)
 {
     $style = $styleInferencer->getStyle($odtElement);
     $textProps = $style->formattingProperties->getProperties(ezcDocumentOdtFormattingProperties::PROPERTIES_TEXT);
     if (isset($textProps['font-weight']) && ($textProps['font-weight'] === 'bold' || $textProps['font-weight'] >= 700)) {
         $odtElement->setProperty('type', 'emphasis');
     }
 }
예제 #2
0
 /**
  * Detects numbered lists from ODT style information.
  *
  * This method detects the type of list in $odtElement by its list-level 
  * style and sets the attributes for $odtElement accordingly to have it 
  * converted properly to DocBook.
  * 
  * @param DOMElement $odtElement 
  * @param ezcDocumentOdtStyleInferencer $styleInferencer
  */
 public function filter(DOMElement $odtElement, ezcDocumentOdtStyleInferencer $styleInferencer)
 {
     $listStyle = $styleInferencer->getListStyle($odtElement);
     $currentLevel = $this->getListLevel($odtElement);
     switch (get_class($listStyle->listLevels[$currentLevel])) {
         case 'ezcDocumentOdtListLevelStyleNumber':
             $this->setNumberListProperties($odtElement, $listStyle->listLevels[$currentLevel]);
             break;
         case 'ezcDocumentOdtListLevelStyleBullet':
             $this->setItemListProperties($odtElement, $listStyle->listLevels[$currentLevel]);
             break;
     }
 }