From: <nma...@us...> - 2006-04-05 15:52:56
|
Revision: 47 Author: nmarkgraf Date: 2006-04-05 08:52:08 -0700 (Wed, 05 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=47&view=rev Log Message: ----------- A lot of refactoring work: - Added some new classes: AbstractDocument (which will replace OpenDocumentAbstract), MimeTypes, AutomaticStylesSplitter (this is a kind of FontFaceDeclSplitter for AutomaticStyles). - Added some interfaces (FontFaceDeclInterface and AutomaticStylesInterface) to keep track of changes in *Splitter and the unsplited classes. - Moved some Stuff from OpenDocumentAbstract to ReleaseInformation(.tpl). Modified Paths: -------------- poc/build.properties poc/build.xml poc/etc/ReleaseInformation.tpl poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/meta/Meta.php poc/src/settings/Settings.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclSplitter.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php poc/src/util/NameSpaces.php Added Paths: ----------- poc/src/styles/AutomaticStylesInterface.php poc/src/styles/AutomaticStylesSplitter.php poc/src/styles/FontFaceDeclInterface.php poc/src/util/AbstractDocument.php poc/src/util/MimeTypes.php Property Changed: ---------------- poc/etc/ReleaseInformation.tpl Modified: poc/build.properties =================================================================== --- poc/build.properties 2006-03-30 14:12:08 UTC (rev 46) +++ poc/build.properties 2006-04-05 15:52:08 UTC (rev 47) @@ -5,7 +5,7 @@ # Last edited by $Author$ # # $Id$ -release=0.4.6 -releaseDos=0_4_6 +release=0.4.7 +releaseDos=0_4_7 # This could be ALPHA, BETA or STABLE revision=ALPHA \ No newline at end of file Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-30 14:12:08 UTC (rev 46) +++ poc/build.xml 2006-04-05 15:52:08 UTC (rev 47) @@ -194,4 +194,12 @@ <delete file="${OpenDocumentPHPSolid}"/> <delete dir="docs"/> </target> + + <target name="clue"> + <php function="ini_set"> + <param value="'include_path'" /> + <param value="${php.classpath};C:\" /> + </php> + <echo msg="${php.classpath}" /> + </target> </project> Modified: poc/etc/ReleaseInformation.tpl =================================================================== --- poc/etc/ReleaseInformation.tpl 2006-03-30 14:12:08 UTC (rev 46) +++ poc/etc/ReleaseInformation.tpl 2006-04-05 15:52:08 UTC (rev 47) @@ -7,7 +7,7 @@ * @license GNU General Public License * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> - * @version $Revision: 39 $ + * @version $Revision$ * @package OpenDocument * @subpackage util * @@ -26,5 +26,44 @@ * X = 1 : "stage 1" code */ const Release = "##release##"; + + /** + * Returns revision information + * + * @return string Revision information. + * @access public + * @final + * @since 0.4.0 + */ + final static public function getRevision() { + $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 static public function getRelease() { + return ReleaseInformation::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 static public function getPackageInformation() { + return self::PackageName . " " . $this->getRelease() . " " . self::Copyright; + } + + } ?> \ No newline at end of file Property changes on: poc/etc/ReleaseInformation.tpl ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/OpenDocumentPackage.php 2006-04-05 15:52:08 UTC (rev 47) @@ -25,10 +25,11 @@ require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentAbstract.php" ); +require_once( "util/AbstractDocument.php" ); require_once( "others/ZipFile.php" ); -class OpenDocumentPackage extends OpenDocumentAbstract implements OpenDocument { +class OpenDocumentPackage extends AbstractDocument implements OpenDocument { private $packagename; private $packagetmp; @@ -45,12 +46,9 @@ */ public function __construct( $documentName=0, $documentPath=0, $mimetype="application/vnd.oasis.opendocument.text" ) { parent::__construct( $mimetype ); - - $this->logger->debug( "Constructing OpenDocumentPackage." ); $this->isCommited = false; - $this->logger->debug( "Generating ZipFile object." ); $this->zip = new ZipFile(); if ( !empty( $documentName ) ) { @@ -59,24 +57,23 @@ $this->path = $documentPath; } } - $this->logger->debug( "Generating Manifest with mimetype \"".$this->getMimeType()."\"." ); - $this->DocumentObjects[ "manifest" ] = new Manifest( $this->getMimeType() ); - $this->DocumentObjects[ "meta" ] = new Meta( ); -// $this->DocumentObjects[ "settings" ] = new Settings( ); - - $this->DocumentObjects[ "content" ] = new Content();; + $this->Manifest = new Manifest( $this->getMimeType() ); + $this->Meta = new Meta(); - $this->DocumentObjects[ "styles" ] = new Styles(); + $this->Content = new Content(); + $this->Styles = new Styles(); - $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - - $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( - $this->DocumentObjects[ "content" ]->getFontFaceDecl(), - $this->DocumentObjects[ "styles" ]->getFontFaceDecl() + $this->Body = $this->Content->getBody(); + $this->Style = $this->Styles->getStyle(); + $this->FontFaceDeclaration = new FontFaceDeclSplitter( + $this->Content->getFontFaceDecl(), + $this->Styles->getFontFaceDecl() ); // Because all other parts will be inserted on demand, there is no need to initialise them here! - + $this->Settings = NULL; + $this->AutomaticStyles = NULL; + $this->MasterStyles = NULL; + $this->Scripts = NULL; } /** @@ -85,17 +82,6 @@ * @since 0.4.0 */ public function __destruct() { - $this->logger->debug( "Destructing OpenDocumentPackage." ); - $this->removeTmpPackage(); - - unset( $this->manifest ); - unset( $this->packagename ); - unset( $this->packagetmp ); - unset( $this->tmp ); - unset( $this->path ); - - $this->logger->debug( "OpenDocumentPackage destructed." ); - parent::__destruct(); } @@ -114,10 +100,7 @@ * @since 0.4.0 */ private function writeDOMToPackage( $fullpath, $dom ) { - //$dom->save( str_replace( "\\", "/", $this->packagetmp . $fullpath) ); $tmp = str_replace( "\\", "/", $fullpath ); - - $this->logger->debug( "Write DOM to package, use fullpath \"" . $tmp . "\"." ); $this->zip->addFile( $dom->saveXML(), $tmp ); unset( $tmp ); @@ -134,12 +117,10 @@ } else { $tmp = $alt; } + clearstatcache(); - $this->logger->debug( "OpenDocumentPackage->writeZIPFile: Write zip file to \"". $tmp ."\"" ); - if ( file_exists( $tmp ) ) { - $this->logger->warning( "OpenDocumentPackage->writeZIPFile: Found old file \"". $tmp ."\", so I remove it first!" ); unlink( $tmp ); } $handle = fopen( $tmp, "wb" ); @@ -147,39 +128,16 @@ fclose( $handle ); unset( $tmp ); } - + /** * - * @access private - * @depricated - * @since 0.4.0 - */ - private function removeTmpPackage() { - // $this->compartibility->removeDir( $this->packagetmp ); - } - - /** - * - * @access private - * @depricated - * @since 0.4.0 - */ - private function makeSubDir( $path ) { - //$this->compartibility->makeDir( $this->packagetmp . $this->compartibility->sep . $path ); - } - - /** - * * @access public * @since 0.4.0 */ public function setPackageName( $filename ) { global $logger; - $this->logger->debug( "OpenDocumentPackage->setPackageName(" . $filename . ")." ); $this->packagename = $filename; - //$this->packagetmp = $this->tmp . $filename . ".tmp" . $this->compartibility->sep; $this->packagetmp = $this->tmp . $filename . ".tmp/"; - $this->logger->debug( "OpenDocumentPackage->set packagetmp to \"" . $this->packagetmp . "\" ..." ); } /** @@ -197,8 +155,7 @@ * @since 0.4.0 */ public function addManifest( $manifest ) { - $this->logger->debug( "OpenDocumentPackage->addManifest(...)." ); - $this->manifest = $manifest; + $this->Manifest = $manifest; } @@ -219,9 +176,7 @@ * @since 0.4.0 */ public function addXMLDocument( $fullpath, $dom, $mimetype="text/xml" ) { - $this->logger->info( "OpenDocumentPackage->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); - - $this->DocumentObjects[ "manifest" ]->addEntryToManifest( $fullpath, $mimetype ); + $this->Manifest->addEntryToManifest( $fullpath, $mimetype ); $this->writeDOMToPackage( $fullpath, $dom ); } @@ -231,30 +186,14 @@ * @since 0.4.0 */ private function commit() { - $this->logger->debug( "OpenDocumentPackage->commit()." ); - foreach($this->DocumentObjects as $key => $docObj) { - $this->logger->debug( "OpenDocumentPackage->commit: found \"" . $key . "\" in DocumentObjects array." ); - switch ($key) { - case "meta" : - $this->addXMLDocument( "meta.xml", $docObj->get() ); - break; - case "styles" : - $this->addXMLDocument( "styles.xml", $docObj->get() ); - break; - case "content" : - $this->addXMLDocument( "content.xml", $docObj->get() ); - break; - case "settings" : - $this->addXMLDocument( "settings.xml", $domObj->get() ); - break; - } - } - - $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->DocumentObjects[ "manifest" ]->get() ); - $this->logger->debug( "OpenDocumentPackage->commit: Write mimetype \"". $this->getMimeType()."\" to file \"mimetype\"..." ); + $this->addXMLDocument( "meta.xml", $this->Meta->get() ); + $this->addXMLDocument( "styles.xml", $this->Styles->get() ); + $this->addXMLDocument( "content.xml", $this->Styles->get() ); + if (!empty($this->Settings)) { + $this->addXMLDocument( "settings.xml", $this->Settings->get() ); + } + $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->Manifest->get() ); $this->zip->addFile( $this->getMimeType(), "mimetype" ); - $this->logger->debug( "OpenDocumentPackage->commit: Commited package named \"" . $this->packagename . "\"..." ); - $this->isCommited = true; } @@ -267,7 +206,6 @@ if (!($this->isCommited)) { $this->commit(); } - $this->logger->debug( "OpenDocumentPackage->get()" ); return $this->zip->file(); } @@ -279,29 +217,17 @@ public function save( $altFilename=0 ) { $this->writeZIPFile( $this->get() ); } - + /** * * @access public * @since 0.4.0 */ - public function getMeta() { - if (!array_key_exists ( "meta", $this->DocumentObjects) ) { - $this->DocumentObjects[ "meta" ] = new Meta(); - } - return $this->DocumentObjects[ "meta" ]; - } - - /** - * - * @access public - * @since 0.4.0 - */ public function getContent() { - if (!array_key_exists ( "content", $this->DocumentObjects) ) { - $this->DocumentObjects[ "content" ] = new Content(); + if (empty($this->Content) ) { + $this->Content = new Content(); } - return $this->DocumentObjects[ "content" ]; + return $this->Content; } /** @@ -309,11 +235,11 @@ * @access public * @since 0.4.0 */ - public function getStyle() { - if (!array_key_exists ( "style", $this->DocumentObjects) ) { - $this->DocumentObjects[ "style" ] = $this->DocumentObjects[ "styles" ]->getStyle(); + public function getStyles() { + if (empty($this->Styles) ) { + $this->Styles = new Styles(); } - return $this->DocumentObjects[ "style" ]; + return $this->Styles; } /** @@ -321,10 +247,9 @@ * @access public * @since 0.4.0 */ - public function getStyles() { - return getStyle(); + public function getStyle() { + return $this->Style; } - /** * @@ -333,46 +258,22 @@ * @since 0.4.4 */ public function getFontFaceDeclaration(){ - return $this->DocumentObjects[ "fontfacedecl" ]; + return $this->FontFaceDeclaration; } - - /** - * - * @access public - * - * @since 0.4.4 - */ - public function getSettings(){ - if (!array_key_exists ( "settings", $this->DocumentObjects) ) { - $this->DocumentObjects[ "settings" ] = new Settings(); - } - return $this->DocumentObjects[ "settings" ]; - } /** * * @access public * - * @since 0.4.0 - */ - public function getBody() { - return $this->DocumentObjects[ "body" ]; - } - - /** - * - * @access public - * * @since 0.4.4 */ public function getScripts(){ - if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "scripts" ] = $this->DocumentObjects[ "content" ]->getScripts(); + if ( empty($this->Scripts) ) { + $this->Scripts = $this->Content->getScripts(); } - return $this->DocumentObjects[ "scripts" ]; + return $this->Scripts; } - /** * * @access public @@ -380,18 +281,13 @@ * @since 0.4.4 */ public function getAutomaticStyles(){ - if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "automaticstyles" ] = 0; -/* -// This should be something like: - $this->DocumentObjects[ "automaticstyles" ] = new AutmaticStylesSplitter( - $this->DocumentObjects[ "content" ]->getAutmaticStyles(), - $this->DocumentObjects[ "styles" ]->getAutomaticStyles() - ); - -*/ + if (empty($this->AutomaticStyles)) { + $this->AutomaticStyles= new AutmaticStylesSplitter( + $this->Content->getAutmaticStyles(), + $this->Styles->getAutomaticStyles() + ); } - return $this->DocumentObjects[ "automaticstyles" ]; + return $this->AutomaticStyles; } /** @@ -401,10 +297,10 @@ * @since 0.4.4 */ public function getMasterStyles(){ - if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = $this->DocumentObjects[ "styles" ]->getMasterStyles(); + if ( empty($this->MasterStyles) ) { + $this->MasterStyles = $this->Styles->getMasterStyles(); } - return $this->DocumentObjects[ "masterstyles" ]; + return $this->MasterStyles; } } Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/OpenDocumentSingle.php 2006-04-05 15:52:08 UTC (rev 47) @@ -24,10 +24,11 @@ require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); -require_once( "OpenDocumentAbstract.php" ); require_once( "util/NameSpaces.php" ); +require_once( "util/MimeTypes.php" ); +require_once( "util/AbstractDocument.php" ); -class OpenDocumentSingle extends OpenDocumentAbstract implements OpenDocument { +class OpenDocumentSingle extends AbstractDocument implements OpenDocument { /** * * @access private @@ -49,28 +50,31 @@ */ private $root; - /** + /** * * @access public * * @since 0.3.0 */ - public function __construct( $mimetype = self::defaultMimeType ) { + public function __construct( $mimetype = MimeTypes::defaultMimeType ) { parent::__construct( $mimetype ); - $this->logger->debug( "Constructing OpenDocumentSingle." ); - $this->isCommited = false; $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document" ); $this->root->setAttributeNS( NS::OFFICE, "office:mimetype", $mimetype ); - - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); - $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); - $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); - // Because all other parts will be inserted on demand, there is no need to initialise them here! + + $this->Meta = new Meta( $this->dom, $this->root ); + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + $this->Style = new Style( $this->dom, $this->root ); + $this->Body = new Body( $this->dom, $this->root ); + + $this->Settings = NULL; + $this->AutomaticStyles = NULL; + $this->MasterStyles = NULL; + $this->Scripts = NULL; + } /** @@ -80,8 +84,6 @@ * @since 0.3.0 */ public function __destruct() { - $this->logger->debug( "OpenDocumentSingle destructed." ); - parent::__destruct(); } @@ -104,7 +106,6 @@ * @since 0.3.0 */ public function addXMLDocument( $fullpath, $domFrag, $mimetype="text/xml" ) { - $this->logger->info( "OpenDocumentSingle->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); $this->dom->appendChild( $domFrag ); } @@ -115,31 +116,30 @@ * @since 0.3.0 */ private function commit() { - $this->logger->debug( "OpenDocumentSingle->commit()" ); // Add Meta data - $this->DocumentObjects[ "meta" ]->commit(); + $this->Meta->commit(); // Add settings, if needed - if ( array_key_exists( "settings", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "settings" ]->commit(); + if ( !empty( $this->Settings ) ){ + $this->Settings->commit(); } // Add scripts, if needed - if ( array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "scripts" ]->get() ); + if ( !empty( $this->Script ) ) { + $this->root->appendChild( $this->Script->get() ); } // Add FontFaceDeclarations - $this->root->appendChild( $this->DocumentObjects[ "fontfacedecl" ]->get() ); + $this->root->appendChild( $this->FontFaceDeclaration->get() ); // Add Style - $this->root->appendChild( $this->DocumentObjects[ "style" ]->get() ); + $this->root->appendChild( $this->Style->get() ); // Add AutomaticSytles, if needed - if ( array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "automaticstyles" ]->get() ); + if ( !empty( $this->AutomaticStyles ) ) { + $this->root->appendChild( $this->AutomaticStyles->get() ); } // Add MasterStyles, if needed - if ( array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "masterstyles" ]->get() ); + if ( !empty( $this->MasterStyles ) ) { + $this->root->appendChild( $this->MasterStyles->get() ); } // Add Body - $this->root->appendChild( $this->DocumentObjects[ "body" ]->get() ); + $this->root->appendChild( $this->Body->get() ); // Add all to DOM document $this->dom->appendChild( $this->root ); // Normalzise DOM document @@ -155,7 +155,6 @@ * @since 0.3.0 */ public function get() { - $this->logger->debug( "OpenDocumentSingle->get()" ); return $this->getAsDOM()->saveXML(); } @@ -169,7 +168,6 @@ if (!($this->isCommited)) { $this->commit(); } - $this->logger->debug( "OpenDocumentSingle->getAsDOM()" ); return $this->dom; } @@ -191,10 +189,10 @@ * @since 0.3.0 */ public function getMeta() { - if ( !array_key_exists( "meta", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); + if ( empty($this->Meta)) { + $this->Meta = new Meta( $this->dom, $this->root ); } - return $this->DocumentObjects[ "meta" ]; + return $this->Meta; } /** @@ -216,7 +214,7 @@ * @since 0.3.0 */ public function getStyles() { - return $this->getStyle(); + return 0; } /** @@ -226,10 +224,10 @@ * @since 0.3.0 */ public function getStyle() { - if ( !array_key_exists( "style", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); + if ( empty($this->Style)) { + $this->Style = new Style( $this->dom, $this->root ); } - return $this->DocumentObjects[ "style" ]; + return $this->Style; } /** @@ -239,7 +237,10 @@ * @since 0.4.0 */ public function getBody() { - return $this->DocumentObjects[ "body" ]; + if ( empty($this->Body)) { + $this->Body = new Body( $this->dom, $this->root ); + } + return $this->Body; } /** @@ -249,7 +250,10 @@ * @since 0.4.4 */ public function getFontFaceDeclaration(){ - return $this->DocumentObjects[ "fontfacedecl" ]; + if ( empty($this->FontFaceDeclaration)) { + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + } + return $this->FontFaceDeclaration; } /** @@ -259,10 +263,10 @@ * @since 0.4.4 */ public function getSettings(){ - if ( !array_key_exists( "settings", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); + if ( empty($this->Settings)) { + $this->Settings = new Settings( $this->dom, $this->root ); } - return $this->DocumentObjects[ "settings" ]; + return $this->Settings; } /** @@ -272,10 +276,10 @@ * @since 0.4.4 */ public function getScripts(){ - if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + if ( empty($this->Scripts)) { + $this->Scripts = new Scripts( $this->dom, $this->root ); } - return $this->DocumentObjects[ "scripts" ]; + return $this->Scripts; } @@ -286,10 +290,10 @@ * @since 0.4.4 */ public function getAutomaticStyles(){ - if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + if ( empty($this->AutomaticStyles)) { + $this->AutomaticStyles = new AutomaticStyles( $this->dom, $this->root ); } - return $this->DocumentObjects[ "automaticstyles" ]; + return $this->AutomaticStyles; } /** @@ -299,11 +303,10 @@ * @since 0.4.4 */ public function getMasterStyles(){ - if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + if ( empty($this->MasterStyles)) { + $this->MasterStyles = new MasterStyles( $this->dom, $this->root ); } - return $this->DocumentObjects[ "masterstyles" ]; + return $this->MasterStyles; } - } ?> \ No newline at end of file Modified: poc/src/content/Body.php =================================================================== --- poc/src/content/Body.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Body.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,16 +12,29 @@ * @subpackage content * @since 0.4.3 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "content/BodyText.php" ); require_once( "content/BodyTable.php" ); require_once( "util/NameSpaces.php" ); -class Body extends OpenDocumentObjectAbstract { - +class Body { /** * * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** + * + * @depricated + * @access private * @since 0.4.3 */ private $DomFragment; @@ -46,10 +59,7 @@ * @access public * @since 0.4.3 */ - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing content/Body." ); - + public function __construct( $dom ) { $this->dom = $dom; $this->BodyFragment = $this->dom->createDocumentFragment(); $this->body = $this->dom->createElementNS( NS::OFFICE, "office:body" ); @@ -62,7 +72,6 @@ * @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 )) { @@ -81,7 +90,6 @@ * @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 ); } @@ -94,7 +102,6 @@ * @since 0.4.3 */ public function getText() { - $this->logger->debug( "content/Body->getText()" ); return $this->getByNamespace( NS::TEXT, "BodyText" ); } @@ -104,7 +111,6 @@ * @since 0.4.3 */ public function getTable() { - $this->logger->debug( "content/Body->getTable()" ); return $this->getByNamespace( NS::TABLE, "BodyTable" ); } @@ -115,7 +121,6 @@ * @since 0.4.3 */ final public function get() { - $this->logger->debug( "content/Body->get()" ); if (!$this->isCommited) { $this->commit(); } Modified: poc/src/content/BodyTable.php =================================================================== --- poc/src/content/BodyTable.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/BodyTable.php 2006-04-05 15:52:08 UTC (rev 47) @@ -13,19 +13,24 @@ * @since 0.4.3 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class BodyTable extends OpenDocumentObjectAbstract { +class BodyTable { + + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + /** * Class construtor. * * @access public * @since 0.4.3 */ - public function __construct( $dom ) { - parent::__construct(); - + public function __construct( $dom ) { $this->dom = $dom; $this->DomFragment = $dom->createDocumentFragment(); $this->body = $this->DomFragment->createElementNS( NS::OFFICE, "office:table" ); Modified: poc/src/content/BodyText.php =================================================================== --- poc/src/content/BodyText.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/BodyText.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,11 +12,24 @@ * @since 0.4.0 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class BodyText extends OpenDocumentObjectAbstract { +class BodyText { /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** * Class construtor. * * @access public @@ -24,9 +37,6 @@ * @since 0.4.0 */ public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); - $this->dom = $dom; $this->text = $this->dom->createElementNS( NS::OFFICE, "office:text" ); } @@ -38,7 +48,6 @@ * @since 0.4.0 */ public function commit() { - $this->logger->debug( "OpenDocumentContentBodyText->commit()" ); $this->isCommited = true; } @@ -49,7 +58,6 @@ * @since 0.4.0 */ public function getTextParagraph( $styleName, $parText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); if (empty($parText)) { $par = $this->dom->createElementNS( NS::TEXT, "text:p" ); } else { @@ -66,7 +74,6 @@ * @since 0.4.0 */ public function addToText( $Node ) { - $this->logger->debug( "OpenDocumentContentBodyText->addToText()" ); $this->text->appendChild( $Node ); } @@ -77,7 +84,6 @@ * @since 0.4.0 */ public function getTextHeading( $styleName, $outlineLevel=1, $headText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); if (empty($headText)) { $head = $this->dom->createElementNS( NS::TEXT, "text:h" ); } else { @@ -95,7 +101,6 @@ * @since 0.4.0 */ public function addNoForms() { - $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); $forms = $this->dom->createElementNS( NS::OFFICE, "office:forms" ); $forms->setAttributeNS( NS::FORM, "form:automatic-focus", "false" ); @@ -112,7 +117,6 @@ * @since 0.4.0 */ final public function get() { - $this->logger->debug( "OpenDocumentContentBodyText->get()" ); if (!$this->isCommited) { $this->commit(); } Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Content.php 2006-04-05 15:52:08 UTC (rev 47) @@ -20,13 +20,54 @@ require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Content extends OpenDocumentObjectAbstract { +class Content { + /** + * + * @access private + * @since 0.4.4 + */ + private $root; - private $root; + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.4 + */ private $Scripts; + + /** + * + * @access private + * @since 0.4.4 + */ private $FontFaceDecl; + + /** + * + * @access private + * @since 0.4.4 + */ private $AutomaticStyles; + + /** + * + * @access private + * @since 0.4.4 + */ private $Body; + + /** + * + * @access private + * @since 0.4.4 + */ private $text; /** @@ -37,8 +78,6 @@ * @since 0.4.0 */ public function __construct() { - parent::__construct(); - $this->logger->debug( "Constructing content/Content." ); // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; Modified: poc/src/content/Scripts.php =================================================================== --- poc/src/content/Scripts.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Scripts.php 2006-04-05 15:52:08 UTC (rev 47) @@ -15,14 +15,13 @@ * * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Scripts extends OpenDocumentObjectAbstract { +class Scripts { + /** * * @access private - * * @since 0.4.4 */ private $scripts; @@ -30,10 +29,16 @@ /** * * @access private - * * @since 0.4.4 */ private $root; + + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; /** * Class construtor. @@ -41,10 +46,7 @@ * @access public * @since 0.4.4 */ - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing content/Scripts." ); - + public function __construct( $dom ) { $this->dom = $dom; $this->scripts = $this->dom->createElementNS( NS::OFFICE, "office:scripts" ); Modified: poc/src/manifest/Manifest.php =================================================================== --- poc/src/manifest/Manifest.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/manifest/Manifest.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,17 +12,38 @@ * @subpackage manifest * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Manifest extends OpenDocumentObjectAbstract { +class Manifest { const odmPUBLIC = "-//OpenOffice.org//DTD Manifest 1.0//EN"; const odmSYSTEM = "Manifest.dtd"; const odmROOT = "manifest:manifest"; const defaultMimeType = "application/vnd.oasis.opendocument.text"; + /** + * + * @access private + * + * @since 0.4.4 + */ private $root; + /** + * + * @access private + * + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $mimetype; + /** * * @access public @@ -30,7 +51,6 @@ * @since 0.4.0 */ public function __construct( $mimetype = self::defaultMimeType ) { - parent::__construct( $mimetype ); $this->createManifestDOM(); } Modified: poc/src/meta/Meta.php =================================================================== --- poc/src/meta/Meta.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/meta/Meta.php 2006-04-05 15:52:08 UTC (rev 47) @@ -16,18 +16,33 @@ * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); +require_once( "util/ReleaseInformation.php" ); +class Meta { -class Meta extends OpenDocumentObjectAbstract { - /** * This points to the "root" element of the meta data. * * @since 0.3.0 */ private $root; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $isCommited; /** * This points to the "root" element of the document meta data structure. @@ -45,10 +60,6 @@ * @since 0.3.0 */ public function __construct( $dom=0, $root=0 ) { - parent::__construct(); - - $this->logger->debug( "Constructing meta/Meta." ); - if (empty($dom)) { // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); @@ -73,14 +84,7 @@ * * @since 0.3.0 */ - public function __destruct() { - unset( $dom ); - unset( $root ); - unset( $meta ); - - $this->logger->debug( "meta/Meta destructed." ); - - parent::__destruct(); + public function __destruct() { } /** @@ -95,7 +99,6 @@ if($tmpDom->load( $filename ) === false) { trigger_error( 'Could not parse XML contents in OpenDocument file' ); - $this->logger->crit( "Could not parse XML contents in OpenDocument file" ); return false; } @@ -126,7 +129,6 @@ * @since 0.3.2 */ public function addDublinCore( $dc, $value) { - $this->logger->debug( "meta/Meta->addDublinCore: ". $value ."." ); $node = $this->dom->createElementNS( NS::DC, "dc:".$dc, $value ); $this->root->appendChild( $node ); unset( $node ); @@ -148,8 +150,6 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } - unset( $nodelist ); - $this->logger->debug( "meta/Meta->getDublinCore: ". $retValue ."." ); return $retValue; } @@ -178,14 +178,10 @@ } else { $creation_time = date( "Y-m-d\TH:i:s", $date ); } - $this->logger->debug( "meta/Meta->addCreationTime: ". $creation_time ."." ); - $node = $this->dom->createElementNS( NS::META, "meta:creation-date", $creation_time ); $this->root->appendChild( $node ); - - unset( $creation_time ); - + } /** @@ -209,20 +205,17 @@ */ public function addGenerator( $generator=0 ) { $lgenerator = ""; - + /* FIX ME !!!*/ if (empty($generator)) { - $lgenerator = "OpenDocmentPHP/".$this->getRelease(); + $lgenerator = "OpenDocmentPHP/" /*.ReleaseInformation->getRelease() */; } else { $lgenerator = $generator; } - $this->logger->debug( "meta/Meta->addGenerator: ". $lgenerator ."." ); - $node = $this->dom->createElementNS( NS::META, "meta:generator", $lgenerator ); $this->root->appendChild( $node ); - unset( $lgenerator ); } /** @@ -254,8 +247,7 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } - unset( $nodelist ); - $this->logger->debug( "meta/Meta->getGenerator: ". $retValue ."." ); + return $retValue; } @@ -266,7 +258,6 @@ * @since 0.4.0 */ public function addInitialCreator( $initialCreator ) { - $this->logger->debug( "meta/Meta->addInitialCreator: ". $initialCreator ."." ); $node = $this->dom->createElementNS( NS::META, "meta:initial-creator", $initialCreator ); $this->root->appendChild( $node ); } @@ -283,8 +274,6 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } -// unset( $nodelist ); - $this->logger->debug( "meta/Meta->getInitialCreator: ". $retValue ."." ); return $retValue; } @@ -304,7 +293,6 @@ $node->setAttributeNS( NS::META, "meta:value", $value ); } $this->root->appendChild( $node ); - unset( $node ); } /** @@ -320,7 +308,6 @@ $this->meta->appendChild( $this->root ); $this->dom->normalize(); $this->isCommited = true; - $this->logger->debug( "meta/Meta->commit()." ); } /** @@ -340,7 +327,6 @@ if (!$this->isCommited) { $this->commit(); } - $this->logger->debug( "OpenDocumentMeta->get()." ); return $this->dom; } @@ -352,7 +338,6 @@ * @since 0.4.0 */ final public function save( $filename ) { - $this->logger->debug( "OpenDocumentMeta->save(". $filename .")." ); $this->get()->save( $filename ); } } Modified: poc/src/settings/Settings.php =================================================================== --- poc/src/settings/Settings.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/settings/Settings.php 2006-04-05 15:52:08 UTC (rev 47) @@ -15,14 +15,12 @@ * * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Settings extends OpenDocumentObjectAbstract { +class Settings { /** * * @access private - * * @since 0.4.4 */ private $settings; @@ -30,18 +28,18 @@ /** * * @access private - * * @since 0.4.4 */ private $root; /** - * This is true, if something was added to settings. - * @accedd private - * @since 0.4.4 + * + * @access private + * @since 0.4.7 */ - private $somethingAdded; - + private $dom; + + /** * Class construtor. * @@ -49,7 +47,6 @@ * @since 0.4.4 */ public function __construct( $dom=0, $root=0 ) { - parent::__construct(); $this->logger->debug( "Constructing settings/Settings." ); if (empty($dom)) { // this is part of a package document Modified: poc/src/styles/AutomaticStyles.php =================================================================== --- poc/src/styles/AutomaticStyles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/AutomaticStyles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -14,10 +14,10 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/AutomaticStylesInterface.php" ); require_once( "util/NameSpaces.php" ); -class AutomaticStyles extends OpenDocumentObjectAbstract { +class AutomaticStyles{ /** * @@ -33,6 +33,12 @@ /** * + * @since 0.4.7 + */ + private $dom; + + /** + * * @param DOMDocument $dom * * @access public @@ -40,10 +46,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root=0) { - parent::__construct(); - - $this->logger->debug( "Constructing styles/AutomaticStyles." ); - $this->dom = $dom; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:automatic-styles" ); } Added: poc/src/styles/AutomaticStylesInterface.php =================================================================== --- poc/src/styles/AutomaticStylesInterface.php (rev 0) +++ poc/src/styles/AutomaticStylesInterface.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,28 @@ +<?php +/** + * AutomaticStyles Interface + * + * + * $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 styles + * @since 0.4.7 + */ + +interface AutomaticStylesInterface { + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function commit(); + +} +?> \ No newline at end of file Property changes on: poc/src/styles/AutomaticStylesInterface.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/styles/AutomaticStylesSplitter.php =================================================================== --- poc/src/styles/AutomaticStylesSplitter.php (rev 0) +++ poc/src/styles/AutomaticStylesSplitter.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,43 @@ +<?php +/** + * AutomaticStylesSplitter Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.7 + */ + +class AutomaticStylesSplitter implements AutomaticStylesInterface { + private $FFD1; + private $FFD2; + /** + * + * @param DOMDocument $dom + * + * @access public + * + * @since 0.4.4 + */ + public function __construct( $f1, $f2 ) { + $this->FFD1 = $f1; + $this->FFD2 = $f2; + } + + /** + * + * @access public + * + * @since 0.4.4 + */ + public function commit() { + $this->isCommited = true; + } + +} +?> \ No newline at end of file Property changes on: poc/src/styles/AutomaticStylesSplitter.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/styles/FontFaceDeclInterface.php =================================================================== --- poc/src/styles/FontFaceDeclInterface.php (rev 0) +++ poc/src/styles/FontFaceDeclInterface.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,35 @@ +<?php +/** + * FontFaceDeclaration Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.7 + */ + +interface FontFaceDeclInterface { + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ); + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function commit(); + +} +?> \ No newline at end of file Property changes on: poc/src/styles/FontFaceDeclInterface.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/styles/FontFaceDeclSplitter.php =================================================================== --- poc/src/styles/FontFaceDeclSplitter.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/FontFaceDeclSplitter.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,9 +12,9 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/FontFaceDeclInterface.php" ); -class FontFaceDeclSplitter extends OpenDocumentObjectAbstract { +class FontFaceDeclSplitter implements FontFaceDeclInterface { private $FFD1; private $FFD2; /** @@ -26,8 +26,6 @@ * @since 0.4.4 */ public function __construct( $f1, $f2 ) { - parent::__construct(); - $this->FFD1 = $f1; $this->FFD2 = $f2; } Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/FontFaceDeclaration.php 2006-04-05 15:52:08 UTC (rev 47) @@ -4,23 +4,32 @@ * * $Id$ * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument * @subpackage styles - * @since 0.4.2 + * @since 0.4.2 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/FontFaceDeclInterface.php" ); require_once( "util/NameSpaces.php" ); -class FontFaceDeclaration extends OpenDocumentObjectAbstract { +class FontFaceDeclaration implements FontFaceDeclInterface { /** * - */ + * @access private + * @since 0.4.2 + */ private $FontFaceDecl; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; /** * @@ -31,7 +40,6 @@ * @since 0.4.2 */ public function __construct( $dom, $root=0) { - parent::__construct(); $this->dom = $dom; $this->useDom2 = false; Modified: poc/src/styles/MasterStyles.php =================================================================== --- poc/src/styles/MasterStyles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/MasterStyles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -14,23 +14,31 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class MasterStyles extends OpenDocumentObjectAbstract { +class MasterStyles { /** * + * @since 0.4.4 */ private $style; /** * + * @since 0.4.4 */ private $root; /** * + * @since 0.4.7 + */ + private $dom; + + + /** + * * @param DOMDocument $dom * * @access public @@ -38,10 +46,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root) { - parent::__construct(); - - $this->logger->debug( "Constructing styles/MasterStyles." ); - $this->dom = $dom; $this->style = $root; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:master-styles" ); Modified: poc/src/styles/Style.php =================================================================== --- poc/src/styles/Style.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/Style.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,10 +12,9 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Style extends OpenDocumentObjectAbstract { +class Style { /** * @@ -31,6 +30,12 @@ /** * + * @since 0.4.7 + */ + private $dom; + + /** + * * @since 0.4.4 */ private $Styles; @@ -43,6 +48,13 @@ /** * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** + * * @param DOMDocument $dom * * @access public @@ -50,10 +62,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root=0) { - parent::__construct(); - - $this->logger->debug( "Constructing style/Style." ); - $this->dom = $dom; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:styles" ); Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/Styles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -18,14 +18,45 @@ require_once( "styles/MasterStyles.php" ); require_once( "util/NameSpaces.php" ); -class Styles extends OpenDocumentObjectAbstract { +class Styles { + + /** + * + * @since 0.4.7 + */ + private $dom; + /** + * + * @since 0.4.0 + */ private $root; + + /** + * + * @since 0.4.0 + */ private $styles; + /** + * + * @since 0.4.5 + */ private $FontFaceDecl; + /** + * + * @since 0.4.5 + */ private $Style; + /** + * + * @since 0.4.5 + */ private $AutomaticStyles; + /** + * + * @since 0.4.5 + */ private $MasterStyles; /** @@ -38,7 +69,6 @@ * @since 0.4.0 */ public function __construct( ) { - parent::__construct(); // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); Added: poc/src/util/AbstractDocument.php =================================================================== --- poc/src/util/AbstractDocument.php (rev 0) +++ poc/src/util/AbstractDocument.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,256 @@ +<?php +/** + * AbstractDocument Class + * + * This class will include Meta, Settings, Scripts, FontFaceDeclarations, Styles, + * Automatic Styles, Master Styles, and Body classes in one single XML file. + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @author Alex Latchford <yaw...@us...> + * @version $Revision$ + * @package OpenDocument + * + * @since 0.3.0 + */ +require_once( "OpenDocument.php" ); + +abstract class AbstractDocument implements OpenDocument { + /** + * + * @access private + * @since 0.4.7 + */ + private $AutomaticStyle; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Body; + + /** + * + * @access private + * @since 0.4.7 + */ + private $FontFaceDeclaration; + + /** + * + * @access private + * @since 0.4.7 + */ + private $MasterStyle; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Meta; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Scripts; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Settings; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Style; + + /** + * The mime type of the document + * + * @access protected + * @since 0.4.7 + */ + protected $mimetype; + + /** + * + * @access public + * @since 0.4.7 + */ + public function __construct( $mimetype = 0 ) { + $this->logger = &Log::factory( "null", "", "OpenDocument" ); + $this->logger->debug( "Constructing AbstractDocument." ); + + $this->mimetype = $mimetype; + } + + /** + * + * @access public + * @since 0.3.0 + */ + public function __destruct() { + $this->logger->debug( "AbstractDocument destructed." ); + $this->logger->close(); + } + + + /** + * + * @access public + * @since 0.4.7 + */ + public function getMeta() { + if ( empty($this->Meta)) { + $this->Meta = new Meta( $this->dom, $this->root ); + } + return $this->Meta; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getStyle() { + if ( empty($this->Style)) { + $this->Style = new Style( $this->dom, $this->root ); + } + return $this->Style; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getBody() { + if ( empty($this->Body)) { + $this->Body = new Body( $this->dom, $this->root ); + } + return $this->Body; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getFontFaceDeclaration(){ + if ( empty($this->FontFaceDeclaration)) { + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + } + return $this->FontFaceDeclaration; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getSettings(){ + if ( empty($this->Settings)) { + $this->Settings = new Settings( $this->dom, $this->root ); + } + return $this->Settings; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getScripts(){ + if ( empty($this->Scripts)) { + $this->Scripts = new Scripts( $this->dom, $this->root ); + } + return $this->Scripts; + } + + + /** + * + * @access public + * @since 0.4.7 + */ + public function getAutomaticStyles(){ + if ( empty($this->AutomaticStyles)) { + $this->AutomaticStyles = new AutomaticStyles( $this->dom, $this->root ); + } + return $this->AutomaticStyles; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getMasterStyles(){ + if ( empty($this->MasterStyles)) { + $this->MasterStyles = new MasterStyles( $this->dom, $this->root ); + } + return $this->MasterStyles; + } + + /** + * 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; + } + + /** + * Returns revision information + * + * @return string Revision information. + * @access public + * @final + * @since 0.4.0 + */ + final public function getRevision() { + $Revision = ""; + return "(".substr("$Revision$",-2).")".ReleaseInformation::Revision; + } + + /** + * Returns release and revision information. + * + * @return string Release and revision information. + * @access public + * @final + * @since 0.4.0 + */ + final public function getRelease() { + return ReleaseInformation::Release.".".ReleaseInformation::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; + } + + +} \ No newline at end of file Property changes on: poc/src/util/AbstractDocument.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/util/MimeTypes.php =================================================================== --- poc/src/util/MimeTypes.php (rev 0) +++ poc/src/util/MimeTypes.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,22 @@ +<?php +/** + * NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage util + * @since 0.4.7 + */ + +class MimeTypes { + const Text = "application/vnd.oasis.opendocument.text"; + const Calc = "application/vnd.oasis.opendocument.calc"; + const defaultMimeType = "application/vnd.oasis.opendocument.text"; +} + +?> \ No newline at end of file Property changes on: poc/src/util/MimeTypes.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/util/NameSpaces.php =================================================================== --- poc/src/util/NameSpaces.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/util/NameSpaces.php 2006-04-05 15:52:08 UTC (rev 47) @@ -10,7 +10,7 @@ * @version $Revision$ * @package OpenDocument * @subpackage util - * @since 0.5.0 + * @since 0.4.6 */ class NameSpaces { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |