blob: 662f64bdadf033261290af08be95bf566a18a581 [file] [log] [blame]
<?php
/**
* File containing the ezcDocumentOdtTableRowStyleGenerator class.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @package Document
* @version //autogen//
* @copyright Copyright (C) 2005-2010 eZ Systems AS. All rights reserved.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @access private
*/
/**
* Class to generate styles for <table:table-row/> elements.
*
* @package Document
* @access private
* @version //autogen//
*/
class ezcDocumentOdtTableRowStyleGenerator extends ezcDocumentOdtStyleGenerator
{
/**
* TableRow property generator.
*
* @var ezcDocumentOdtStyleTableRowPropertyGenerator
*/
protected $tableRowPropertyGenerator;
/**
* Creates a new style genertaor.
*
* @param ezcDocumentOdtPcssConverterManager $styleConverters
*/
public function __construct( ezcDocumentOdtPcssConverterManager $styleConverters )
{
$this->tableRowPropertyGenerator = new ezcDocumentOdtStyleTableRowPropertyGenerator(
$styleConverters
);
}
/**
* Returns if the given $odtElement is handled by this generator.
*
* @param DOMElement $odtElement
* @return bool
*/
public function handles( DOMElement $odtElement )
{
return (
$odtElement->localName === 'table-row'
);
}
/**
* 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-row'
);
$style->setAttributeNS(
ezcDocumentOdt::NS_ODT_STYLE,
'style:name',
$styleName
);
$odtElement->setAttributeNS(
ezcDocumentOdt::NS_ODT_TABLE,
'table:style-name',
$styleName
);
$this->tableRowPropertyGenerator->createProperty(
$style,
$styleAttributes
);
}
}
?>