From: <nma...@us...> - 2006-03-20 22:15:08
|
Revision: 35 Author: nmarkgraf Date: 2006-03-20 14:14:51 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=35&view=rev Log Message: ----------- Minor changes: - Reverted to changes on OpenDocumentPackage and OpenDocumentSingle. Comment is in the source. - Minor bug fix in content/Content Modified Paths: -------------- poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Content.php Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/OpenDocumentPackage.php 2006-03-20 22:14:51 UTC (rev 35) @@ -46,9 +46,6 @@ $this->logger->debug( "Constructing OpenDocumentPackage." ); - $this->dom = new DOMDocument( "1.0", "utf-8" ); - $this->dom->formatOutput = true; - $this->isCommited = false; $this->logger->debug( "Generating ZipFile object." ); @@ -61,24 +58,23 @@ } } $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[ "manifest" ] = new Manifest( $this->getMimeType() ); + $this->DocumentObjects[ "meta" ] = new Meta( ); +// $this->DocumentObjects[ "settings" ] = new Settings( ); - $this->DocumentObjects[ "content" ] = new Content();; + $this->DocumentObjects[ "content" ] = new Content();; - $this->DocumentObjects[ "styles" ] = new Styles(); + $this->DocumentObjects[ "styles" ] = new Styles(); - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom ); - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom ); - $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - + $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->DocumentObjects[ "automaticstyles" ] = new AutomaticStylesSpliter(... ); -// $this->DocumentObjects[ "masterstyles" ] = $styles->getMasterStyles(); + $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); + $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( + $this->DocumentObjects[ "content" ]->getFontFaceDecl(), + $this->DocumentObjects[ "styles" ]->getFontFaceDecl() + ); + // Because all other parts will be inserted on demand, there is no need to initialise them here! + } /** @@ -246,11 +242,9 @@ case "content" : $this->addXMLDocument( "content.xml", $docObj->get() ); break; -/* case "settings" : - $this->addXMLDocument( "settings.xml", $dom ); + $this->addXMLDocument( "settings.xml", $domObj->get() ); break; -*/ } } @@ -347,7 +341,10 @@ * @since 0.4.4 */ public function getSettings(){ - return 0; + if (!array_key_exists ( "settings", $this->DocumentObjects) ) { + $this->DocumentObjects[ "settings" ] = new Settings(); + } + return $this->DocumentObjects[ "settings" ]; } /** @@ -383,6 +380,14 @@ 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() + ); + +*/ } return $this->DocumentObjects[ "automaticstyles" ]; } @@ -395,7 +400,7 @@ */ public function getMasterStyles(){ if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = 0; + $this->DocumentObjects[ "masterstyles" ] = $this->DocumentObjects[ "styles" ]->getMasterStyles(); } return $this->DocumentObjects[ "masterstyles" ]; } Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/OpenDocumentSingle.php 2006-03-20 22:14:51 UTC (rev 35) @@ -71,14 +71,11 @@ $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document" ); $this->root->setAttributeNS( self::NS_OFFICE, "office:mimetype", $mimetype ); - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); -// $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + $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[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); -// $this->DocumentObjects[ "masterstyles" ] = new MasterStyles( $this->dom, $this->root ); - $this->DocumentObjects[ "body" ] = new Body( $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! } /** Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/content/Content.php 2006-03-20 22:14:51 UTC (rev 35) @@ -4,13 +4,13 @@ * * $Id$ * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * - * @since 0.4.4 + * @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.4 */ require_once( "content/Scripts.php" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |