|
From: <nma...@us...> - 2006-03-13 15:14:04
|
Revision: 24 Author: nmarkgraf Date: 2006-03-13 07:13:43 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=24&view=rev Log Message: ----------- THIS IS THE FIRST RELEASE OF 0.4.3! Major changes - Moved and renamed OpenDocumentContentBody*.php to content/Body*.php. - Change OpenDocumentContent to match this moving and renaming. Minor changes: - Added some new comments - New revision tag in OpenDocumentAbstract. - New release tag -> 0.4.3 Modified Paths: -------------- poc/src/OpenDocumentAbstract.php poc/src/OpenDocumentContent.php poc/src/OpenDocumentFactory.php poc/src/OpenDocumentMeta.php poc/src/OpenDocumentStyle.php poc/src/samples/TestTranslate.php Added Paths: ----------- poc/src/content/ poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php Removed Paths: ------------- poc/src/OpenDocumentContentBody.php poc/src/OpenDocumentContentBodyText.php Modified: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentAbstract.php 2006-03-13 15:13:43 UTC (rev 24) @@ -8,7 +8,7 @@ * $Id$ * * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, et. al. + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument @@ -18,28 +18,74 @@ class OpenDocumentAbstract { /** - * + * Is this ALPHA, BETA or STABLE code? */ const Revision = "ALPHA"; - const Release = "0.4.2"; - const Copyright = "(C) in 2006 by Norman Markgraf published under GPL 2.0"; + + /** + * Release number: X.Y.Z + * + * X = 0 : "proof of concept" (a.k.a POC) code + * X = 1 : "stage 1" code + */ + const Release = "0.4.3"; + + /** + * Copyright notice for this package. + */ + const Copyright = "(C) in 2006 by Norman Markgraf, Alex Latchford, et al."; + + /** + * Name of this package. + */ const PackageName = "OpenDocumentPHP"; + + /** + * Default mime type is set to a text document. + */ const defaultMimeType = "application/vnd.oasis.opendocument.text"; + /** + * The PEAR::Log logger + * + * @access protected + * @since 0.4.0 + */ protected $logger; + /** + * The mime type of the document + * + * @access protected + * @since 0.4.0 + */ protected $mimetype; - /** - * This is the storage for all OpenDocument objects - */ + /** + * This is the storage for all OpenDocument objects + * + * @access protected + * @since 0.3.0 + */ protected $DocumentObjects; + /** + * This construtor will set the mimetype of this document and start logging. + * + * Therefor this line is included in this constructor: + * <code> + * $this->logger = &Log::factory( "null", "", "OpenDocument" ); + * </code> + * + * @param string $mimetype The mime type of this document. + * @access public + * @since 0.3.0 + */ public function __construct( $mimetype = 0 ) { $this->logger = &Log::factory( "null", "", "OpenDocument" ); - //$this->logger = &Log::factory( "file", "d:/PHP/OpenDocumentPHP.log", "OpenDocument" ); $this->logger->debug( "Constructing OpenDocumentAbstract." ); + // make an array for all the Document Objects. $this->DocumentObjects = array(); if (!empty($mimetype)) { @@ -48,34 +94,73 @@ } /** - * - */ + * + * @access public + * @since 0.3.0 + */ public function __destruct() { $this->logger->debug( "OpenDocumentAbstract destructed." ); $this->logger->close(); } + /** + * Returns revision information + * + * @return string Revision information. + * @access public + * @final + * @since 0.4.0 + */ final public function getRevision() { - return self::Revision; + $Revision = ""; + return "(".substr("$Revision$",-2).")".self::Revision; } + /** + * Returns release and revision information. + * + * @return string Release and revision information. + * @access public + * @final + * @since 0.4.0 + */ final public function getRelease() { return self::Release.".".self::Revision; } + /** + * Returns some informations about this package, release and copyright. + * + * @return string Package name, release and copyright. + * @access public + * @final + * @since 0.4.0 + */ final public function getPackageInformation() { return self::PackageName . " " . $this->getRelease() . " " . self::Copyright; } + /** + * + * @access public + * @final + * @since 0.4.0 + */ final public function attachObserverToLogger( $observer ) { $this->logger->attach( $observer ); } + /** + * Returns the setted mime type of this document. + * + * @return string Current mime type of this document. + * @access public + * @final + * @since 0.4.0 + */ final public function getMimeType() { return $this->mimetype; } - } - ?> \ No newline at end of file Modified: poc/src/OpenDocumentContent.php =================================================================== --- poc/src/OpenDocumentContent.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentContent.php 2006-03-13 15:13:43 UTC (rev 24) @@ -4,7 +4,8 @@ * * $Id$ * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument @@ -12,6 +13,8 @@ * @since 0.4.0 */ +require_once( "content/Body.php" ); + class OpenDocumentContent extends OpenDocumentObjectAbstract { private $root; @@ -21,7 +24,10 @@ private $text; /** + * Class construtor. * + * @param DOMDocument $dom Main DOM document. If 0, than we produce a <b>meta.xml</b> document. + * @param DOMElement $root Root element of DOM document, needed if <b>$dom</b> was not 0. * @access public * * @since 0.4.0 @@ -45,7 +51,7 @@ $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:content" ); } $this->FontFaceDecl = new FontFaceDelcation(); - $this->body = new OpenDocumentContentBody( $this->dom ); + $this->body = new Body( $this->dom ); } /** @@ -169,7 +175,7 @@ /** * - * @param $filename string + * @param string $filename * * @access public * @final Deleted: poc/src/OpenDocumentContentBody.php =================================================================== --- poc/src/OpenDocumentContentBody.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentContentBody.php 2006-03-13 15:13:43 UTC (rev 24) @@ -1,76 +0,0 @@ -<?php -/** - * OpenDocumentContentBody Class - * - * $Id$ - * - * @copyright GNU General Public License - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument.Content.Body - * @since POC 0.5 - */ - -class OpenDocumentContentBody extends OpenDocumentObjectAbstract { - - private $DomFragment; - private $body; - - private $Fragments; - - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing OpenDocumentContentBody." ); - - $this->dom = $dom; - $this->BodyFragment = $this->dom->createDocumentFragment(); - $this->body = $this->dom->createElementNS( self::NS_OFFICE, "office:body" ); - $this->Fragments = array(); - } - - public function commit() { - $this->logger->debug( "OpenDocumentContentBody->commit()" ); - foreach( $this->Fragments as $namespace => $class ) { - $tmp = $class->get(); - if (!empty( $tmp )) { - $this->BodyFragment->appendChild( $class->get() ); - } - } - if (!empty( $this->BodyFragment )) { - $this->body->appendChild( $this->BodyFragment ); - } - $this->isCommited = true; - } - - private function getByNamespace( $NS, $class ) { - $this->logger->debug( "OpenDocumentContentBody->getByNamespace(\"".$NS."\", \"".$class."\")" ); - if (!array_key_exists( $NS, $this->Fragments ) ) { - $this->Fragments[ $NS ] = new $class( $this->dom ); - } - return $this->Fragments[ $NS ]; - } - - public function getText() { - $this->logger->debug( "OpenDocumentContentBody->getText()" ); - return $this->getByNamespace( self::NS_TEXT, "OpenDocumentContentBodyText" ); - } - - public function getTable() { - $this->logger->debug( "OpenDocumentContentBody->getTable()" ); - return $this->getByNamespace( self::NS_TABLE, "OpenDocumentContentBodyTable" ); - } - - /** - * @return DOMDocumentFragment body fragment - */ - final public function get() { - $this->logger->debug( "OpenDocumentContentBody->get()" ); - if (!$this->isCommited) { - $this->commit(); - } - return $this->body; - } - -} - -?> \ No newline at end of file Deleted: poc/src/OpenDocumentContentBodyText.php =================================================================== --- poc/src/OpenDocumentContentBodyText.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentContentBodyText.php 2006-03-13 15:13:43 UTC (rev 24) @@ -1,116 +0,0 @@ -<?php -/** - * OpenDocumentContentBodyText Class - * - * $Id$ - * - * @copyright GNU General Public License - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument.Content.Body.Text - * @since 0.4.2 - */ - -class OpenDocumentContentBodyText extends OpenDocumentObjectAbstract { - /** - * - * @access public - * - * @since 0.4.0 - */ - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); - - $this->dom = $dom; - $this->text = $this->dom->createElementNS( self::NS_OFFICE, "office:text" ); - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function commit() { - $this->logger->debug( "OpenDocumentContentBodyText->commit()" ); - $this->isCommited = true; - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function getTextParagraph( $styleName, $parText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); - if (empty($parText)) { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p" ); - } else { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p", $parText ); - } - $par->setAttributeNS( self::NS_STYLE, "style:name", $styleName ); - return $par; - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function addToText( $Node ) { - $this->logger->debug( "OpenDocumentContentBodyText->addToText()" ); - $this->text->appendChild( $Node ); - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function getTextHeading( $styleName, $headText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); - if (empty($headText)) { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h" ); - } else { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h", $headText ); - } - $head->setAttributeNS( self::NS_STYLE, "style:name", $styleName ); - return $head; - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function addNoForms() { - $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); - $forms = $this->dom->createElementNS( self::NS_OFFICE, "office:forms" ); - - $forms->setAttributeNS( self::NS_FORM, "form:automatic-focus", "false" ); - $forms->setAttributeNS( self::NS_FORM, "form:apply-design-mode", "false" ); - - $this->text->appendChild( $forms ); - unset( $forms ); - } - - /** - * @return DOMDocumentFragment body fragment - * @access public - * - * @since 0.4.0 - */ - final public function get() { - $this->logger->debug( "OpenDocumentContentBodyText->get()" ); - if (!$this->isCommited) { - $this->commit(); - } - return $this->text; - } -} -?> \ No newline at end of file Modified: poc/src/OpenDocumentFactory.php =================================================================== --- poc/src/OpenDocumentFactory.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentFactory.php 2006-03-13 15:13:43 UTC (rev 24) @@ -5,11 +5,11 @@ * $Id$ * * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et. al. + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> * @author Alex Latchford <yaw...@us...> * @version $Revision$ - * @package OpenDocument.Factory + * @package OpenDocument * @since 0.4.0 */ @@ -50,7 +50,7 @@ final class OpenDocumentFactory { const defaultMimeType = "application/vnd.oasis.opendocument.text"; /** - * Creates a OpenDocument. + * Creates an OpenDocument. * * @param string $documentName * @param string $documentPath Modified: poc/src/OpenDocumentMeta.php =================================================================== --- poc/src/OpenDocumentMeta.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentMeta.php 2006-03-13 15:13:43 UTC (rev 24) @@ -2,6 +2,9 @@ /** * OpenDocumentMeta Class * + * In this class we will store all meta stuff. + * + * * $Id$ * * @license GNU General Public License @@ -15,16 +18,29 @@ class OpenDocumentMeta extends OpenDocumentObjectAbstract { + /** + * This points to the "root" element of the meta data. + * + * @since 0.3.0 + */ private $root; - private $meta; - + /** - * - * @access public + * This points to the "root" element of the document meta data structure. * - * @since 0.3.0 + * @since 0.4.0 */ - public function __construct( $dom=0, $_root=0 ) { + private $meta; + + /** + * + * @param DOMDocument $dom Main DOM document. If 0, than we produce a <b>meta.xml</b> document. + * @param DOMElement $root Root element of DOM document, needed if <b>$dom</b> was not 0. + * @access public + * + * @since 0.3.0 + */ + public function __construct( $dom=0, $root=0 ) { parent::__construct(); $this->logger->debug( "Constructing OpenDocumentMeta." ); @@ -42,17 +58,17 @@ } else { // this is part of a single document $this->dom = $dom; - $this->meta = $_root; + $this->meta = $root; } $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:meta" ); } - /** - * - * @access public - * - * @since 0.3.0 - */ + /** + * + * @access public + * + * @since 0.3.0 + */ public function __destruct() { unset( $dom ); unset( $root ); @@ -63,12 +79,13 @@ parent::__destruct(); } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * + * @todo THIS CODE IS HIGHLY UNTESTED AND CURRENTLY NOT USEABLE AT ALL!!! + * @access public + * + * @since 0.4.0 + */ public function load( $filename ) { $tmpDom = new DOMDocument(); @@ -95,12 +112,15 @@ return true; } - /** - * - * @access public - * - * @since 0.3.2 - */ + /** + * Add Dublin Core meta data. + * + * @param string $dc Tag (without "dc:") for Dublin Core meta data. + * @param string $value Value of the Dublin Core meta data. + * @access public + * + * @since 0.3.2 + */ public function addDublinCore( $dc, $value) { $this->logger->debug( "OpenDocumentMeta->addDublinCore: ". $value ."." ); $node = $this->dom->createElementNS( self::NS_DC, "dc:".$dc, $value ); @@ -108,12 +128,16 @@ unset( $node ); } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * Retrieve Dublin Core meta data. + * + * @param string $dc Tag (without "dc:") for Dublin Core meta data. + * @return string Value of the Dublin Core meta data. + * + * @access public + * + * @since 0.4.0 + */ public function getDublicCore( $dc ) { $retValue = ""; $nodelist = $this->dom->getElementsByTagNameNS( self::NS_DC, $dc ); @@ -128,15 +152,16 @@ /** * Add the "Creation Date" of the current OpenDocument to the Meta file. * - * You can give a timestamp made by <c>mktime()</c> or nothing as parameter. + * You can give a timestamp made by <b>mktime()</b> or nothing as a parameter. * If no parameter is given, the current time and date will be used. * <code> + * // Let $Document be a class implementing the OpenDocument interface. * // This will set the current date and time: - * Document->getMeta()->addCreationDate() - * // This will set the creation date to (April, 4th 1968 - 10:11:12) - * Document->getMeta()->addCreationDate( mktime( 10, 11, 12, 4, 3, 1968 ) ); + * $Document->getMeta()->addCreationDate() + * // This will set the creation date to (April, 3th 1968 - 10:11:12) + * $Document->getMeta()->addCreationDate( mktime( 10, 11, 12, 4, 3, 1968 ) ); * </code> - * @param $date Timestamp or 0 = now. + * @param timestamp $date Timestamp or 0 = now. * * @access public * @@ -159,12 +184,25 @@ } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * Add a "Generator" to the Meta file. + * + * You can give your own generator message or use the default value, given by + * OpenDocumentPHP. + * <code> + * // Let $Document be a class implementing the OpenDocument interface. + * // This will set the default value of the generator: + * $Document->getMeta()->addGenerator() + * // This will set the the generator message to "My OD generator": + * $Document->getMeta()->addGenerator( "My OD generator" ); + * </code> + * + * @param string $generator New generator message, of default if 0. + * + * @access public + * + * @since 0.4.0 + */ public function addGenerator( $generator=0 ) { $lgenerator = ""; @@ -183,12 +221,27 @@ unset( $lgenerator ); } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * Retrieve the current generator message. + * + * You can get the current information about the generator of the Meta file by: + * <code> + * // Let $Document be a class implementing the OpenDocument interface. + * $IsGeneratedByOpenDocumentPHP = stripos( $Document->getGenerator(), "OpenDocumentPHP/" ); + * if ( $IsGeneratedByOpenDocumentPHP === false ) { + * echo "This file was (probably) not created by OpenDocumentPHP!"; + * } + * if ( $IfGeneratedByOpenDocumentPHP !== false ) { + * echo "This file was generated by OpenDocumentPHP!"; + * } + * </code> + * + * @return string Current generator information stored in Meta. + * + * @access public + * + * @since 0.4.0 + */ public function getGenerator() { $retValue = ""; @@ -202,24 +255,24 @@ return $retValue; } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * + * @access public + * + * @since 0.4.0 + */ public function addInitialCreator( $initialCreator ) { $this->logger->debug( "OpenDocumentMeta->addInitialCreator: ". $initialCreator ."." ); $node = $this->dom->createElementNS( self::NS_META, "meta:initial-creator", $initialCreator ); $this->root->appendChild( $node ); } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * + * @access public + * + * @since 0.4.0 + */ public function getInitialCreator() { $retValue = ""; $nodelist = $this->dom->getElementsByTagNameNS( self::NS_META, "initial-creator" ); @@ -231,12 +284,12 @@ return $retValue; } - /** - * - * @access public - * - * @since 0.4.0 - */ + /** + * + * @access public + * + * @since 0.4.0 + */ public function addUserDefinedMetadata( $name, $type, $value ) { $node = $this->dom->createElementNS( self::NS_META, "meta:user-defined" ); $node->setAttributeNS( self::NS_META, "meta:name", $name ); @@ -250,14 +303,15 @@ unset( $node ); } - /** - * Commits all changes to Meta and normalize them. After a commit call, you couldn't add - * new things to Meta. - * - * @access public - * - * @since 0.4.0 - */ + /** + * Commits all changes to Meta and normalize them. + * + * After a commit call, you couldn't add new things to Meta. + * + * @access public + * + * @since 0.4.0 + */ public function commit() { $this->meta->appendChild( $this->root ); $this->dom->normalize(); @@ -265,19 +319,19 @@ $this->logger->debug( "OpenDocumentMeta->commit()." ); } - /** - * Get Meta as DOMDocument. - * - * If this object is not commited, this method will first call <c>commit()</c> and return the - * Meta as DOMDocument after that. - * - * @return DOMDocument Meta as DOMDocument. - * - * @access public - * @final - * - * @since 0.4.0 - */ + /** + * Get Meta as DOMDocument. + * + * If this object is not commited, this method will first call <b>commit()</b> and return the + * Meta as DOMDocument after that. + * + * @return DOMDocument Meta as DOMDocument. + * + * @access public + * @final + * + * @since 0.4.0 + */ final public function get() { if (!$this->isCommited) { $this->commit(); @@ -286,13 +340,13 @@ return $this->dom; } - /** - * - * @access public - * @final - * - * @since 0.4.0 - */ + /** + * + * @access public + * @final + * + * @since 0.4.0 + */ final public function save( $filename ) { $this->logger->debug( "OpenDocumentMeta->save(". $filename .")." ); $this->get()->save( $filename ); Modified: poc/src/OpenDocumentStyle.php =================================================================== --- poc/src/OpenDocumentStyle.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/OpenDocumentStyle.php 2006-03-13 15:13:43 UTC (rev 24) @@ -24,7 +24,10 @@ private $DefaultStyles; /** + * Class construtor. * + * @param DOMDocument $dom Main DOM document. If 0, than we produce a <b>meta.xml</b> document. + * @param DOMElement $root Root element of DOM document, needed if <b>$dom</b> was not 0. * @access public * * @since 0.4.0 @@ -53,6 +56,7 @@ } /** + * Class destructor. * * @access public * Added: poc/src/content/Body.php =================================================================== --- poc/src/content/Body.php (rev 0) +++ poc/src/content/Body.php 2006-03-13 15:13:43 UTC (rev 24) @@ -0,0 +1,123 @@ +<?php +/** + * body (former OpenDocumentContentBody) Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage content + * @since 0.4.3 + */ + +class Body extends OpenDocumentObjectAbstract { + + /** + * + * @access private + * @since 0.4.3 + */ + private $DomFragment; + + /** + * + * @access private + * @since 0.4.3 + */ + private $body; + + /** + * + * @access private + * @since 0.4.3 + */ + private $Fragments; + + /** + * Class construtor. + * + * @access public + * @since 0.4.3 + */ + public function __construct( $dom ) { + parent::__construct(); + $this->logger->debug( "Constructing content/Body." ); + + $this->dom = $dom; + $this->BodyFragment = $this->dom->createDocumentFragment(); + $this->body = $this->dom->createElementNS( self::NS_OFFICE, "office:body" ); + $this->Fragments = array(); + } + + /** + * + * @access public + * @since 0.4.3 + */ + public function commit() { + $this->logger->debug( "content/Body->commit()" ); + foreach( $this->Fragments as $namespace => $class ) { + $tmp = $class->get(); + if (!empty( $tmp )) { + $this->BodyFragment->appendChild( $class->get() ); + } + } + if (!empty( $this->BodyFragment )) { + $this->body->appendChild( $this->BodyFragment ); + } + $this->isCommited = true; + } + + /** + * + * @access private + * @since 0.4.3 + */ + private function getByNamespace( $NS, $class ) { + $this->logger->debug( "content/Body->getByNamespace(\"".$NS."\", \"".$class."\")" ); + if (!array_key_exists( $NS, $this->Fragments ) ) { + $this->Fragments[ $NS ] = new $class( $this->dom ); + } + return $this->Fragments[ $NS ]; + } + + /** + * + * @access public + * @since 0.4.3 + */ + public function getText() { + $this->logger->debug( "content/Body->getText()" ); + return $this->getByNamespace( self::NS_TEXT, "BodyText" ); + } + + /** + * + * @access public + * @since 0.4.3 + */ + public function getTable() { + $this->logger->debug( "content/Body->getTable()" ); + return $this->getByNamespace( self::NS_TABLE, "BodyTable" ); + } + + /** + * + * @return DOMDocumentFragment body fragment + * @access public + * @since 0.4.3 + */ + final public function get() { + $this->logger->debug( "content/Body->get()" ); + if (!$this->isCommited) { + $this->commit(); + } + return $this->body; + } + +} + +?> \ No newline at end of file Property changes on: poc/src/content/Body.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/content/BodyTable.php =================================================================== --- poc/src/content/BodyTable.php (rev 0) +++ poc/src/content/BodyTable.php 2006-03-13 15:13:43 UTC (rev 24) @@ -0,0 +1,53 @@ +<?php +/** + * BodyTable (former OpenDocumentContentBodyTable) Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage content + * @since 0.4.3 + */ + +class BodyTable extends OpenDocumentObjectAbstract { + /** + * Class construtor. + * + * @access public + * @since 0.4.3 + */ + public function __construct( $dom ) { + parent::__construct(); + + $this->dom = $dom; + $this->DomFragment = $dom->createDocumentFragment(); + $this->body = $this->DomFragment->createElementNS( self::NS_OFFICE, "office:table" ); + } + + /** + * + * @access public + * @since 0.4.3 + */ + public function commit() { + $this->isCommited = true; + } + + /** + * @return DOMDocumentFragment body fragment + * @access public + * @final + * @since 0.4.3 + */ + final public function get() { + if (!$this->isCommited) { + $this->commit(); + } + return $this->DomFragment; + } +} +?> \ No newline at end of file Property changes on: poc/src/content/BodyTable.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/content/BodyText.php =================================================================== --- poc/src/content/BodyText.php (rev 0) +++ poc/src/content/BodyText.php 2006-03-13 15:13:43 UTC (rev 24) @@ -0,0 +1,118 @@ +<?php +/** + * BodyTest (former OpenDocumentContentBodyText) Class + * + * $Id$ + * + * @copyright GNU General Public License + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage content + * @since 0.4.0 + */ + +class BodyText extends OpenDocumentObjectAbstract { + /** + * Class construtor. + * + * @access public + * + * @since 0.4.0 + */ + public function __construct( $dom ) { + parent::__construct(); + $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); + + $this->dom = $dom; + $this->text = $this->dom->createElementNS( self::NS_OFFICE, "office:text" ); + } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function commit() { + $this->logger->debug( "OpenDocumentContentBodyText->commit()" ); + $this->isCommited = true; + } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function getTextParagraph( $styleName, $parText=0 ) { + $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); + if (empty($parText)) { + $par = $this->dom->createElementNS( self::NS_TEXT, "text:p" ); + } else { + $par = $this->dom->createElementNS( self::NS_TEXT, "text:p", $parText ); + } + $par->setAttributeNS( self::NS_STYLE, "style:name", $styleName ); + return $par; + } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function addToText( $Node ) { + $this->logger->debug( "OpenDocumentContentBodyText->addToText()" ); + $this->text->appendChild( $Node ); + } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function getTextHeading( $styleName, $headText=0 ) { + $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); + if (empty($headText)) { + $head = $this->dom->createElementNS( self::NS_TEXT, "text:h" ); + } else { + $head = $this->dom->createElementNS( self::NS_TEXT, "text:h", $headText ); + } + $head->setAttributeNS( self::NS_STYLE, "style:name", $styleName ); + return $head; + } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function addNoForms() { + $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); + $forms = $this->dom->createElementNS( self::NS_OFFICE, "office:forms" ); + + $forms->setAttributeNS( self::NS_FORM, "form:automatic-focus", "false" ); + $forms->setAttributeNS( self::NS_FORM, "form:apply-design-mode", "false" ); + + $this->text->appendChild( $forms ); + unset( $forms ); + } + + /** + * @return DOMDocumentFragment body fragment + * @access public + * + * @since 0.4.0 + */ + final public function get() { + $this->logger->debug( "OpenDocumentContentBodyText->get()" ); + if (!$this->isCommited) { + $this->commit(); + } + return $this->text; + } +} +?> \ No newline at end of file Property changes on: poc/src/content/BodyText.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/samples/TestTranslate.php =================================================================== --- poc/src/samples/TestTranslate.php 2006-03-13 11:06:19 UTC (rev 23) +++ poc/src/samples/TestTranslate.php 2006-03-13 15:13:43 UTC (rev 24) @@ -9,7 +9,7 @@ * @author Alex Latchford <yaw...@us...> * @version $Revision$ * @package OpenDocument - * @subpackage samles + * @subpackage samples * @since 0.4.2 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |