phpDocumentor OpenDocumentPHP
[ class tree: OpenDocumentPHP ] [ index: OpenDocumentPHP ] [ all elements ]

Class: OpenDocumentText

Source Location: /OpenDocumentText.php

Class OpenDocumentText

Class Overview

OpenDocumentText class.

You could uses this class as follows:

  1.          $text new OpenDocumentText'YourFavoriteTextDocument.odt' );
  2.          // do some thing with it
  3.          ...
  4.          // And write it back
  5.          $text->close();

If you want to revert all modifications and do not write anything back to the archive you can use the first parameter of this function and set it to false.

  1.       $text new OpenDocumentText($fullpath);
  2.       //... do something ...
  3.       // But we do not want to write it back to the archive
  4.       $text->closefalse );

Be aware that even if you do not modifiy the OpenDocument, the library will! So do not expect the that the file is absolute the same after you run the close method.

You can use the setDefaultMeta() method to set up some meta datas. Also you can use the setDefaultFontFace() and setDefaultStyles() methods to bring in some fonts, so you can write a short text. You should take a look at this methods and write your own methods to match your needs.

Located in /OpenDocumentText.php [line 88]

ZipArchive
   |
   --OpenDocumentArchive
      |
      --OpenDocumentAbstract
         |
         --OpenDocumentText
Author(s):
  • Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
Information Tags:
Version:  Release: @package_version@
Copyright:  Copyright in 2006, 2007 by The OpenDocumentPHP Team
Link:  http://opendocumentphp.org
Since:  0.5.0 - 08. Feb. 2007
License:  GNU General Public License 2.0.

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OpenDocumentAbstract

OpenDocumentAbstract::$content
OpenDocumentAbstract::$meta
OpenDocumentAbstract::$settings
OpenDocumentAbstract::$styles

Inherited From OpenDocumentAbstract

OpenDocumentAbstract::close()
Close the current OpenDocument.
OpenDocumentAbstract::getBody()
Retrieve the body part of the content document as an object of the BodyFragment class.
OpenDocumentAbstract::getContent()
Retrieve the content document as an object of the ContentDocument class.
OpenDocumentAbstract::getMeta()
Retrieve the meta document as an object of the MetaDocument class.
OpenDocumentAbstract::getStyles()
Retrieve the styles document as an object of the StylesDocument class.
OpenDocumentAbstract::init()
Initialise the usual attributes of this class.
OpenDocumentAbstract::loadContent()
Load content document.
OpenDocumentAbstract::loadMeta()
Load meta document.
OpenDocumentAbstract::loadSettings()
Load settings document.
OpenDocumentAbstract::loadStyles()
Load styles document.
OpenDocumentAbstract::open()
Open an OpenDocument and read the meta, settings, content and styles data out of the ususal xml files and stores them into their attributes.

Inherited From OpenDocumentArchive

OpenDocumentArchive::__construct()
Constructor method.
OpenDocumentArchive::addFile()
Adds a file to a ZIP archive from the given path.
OpenDocumentArchive::addFromString()
Add a file to a ZIP archive using its contents.
OpenDocumentArchive::close()
Close opened or created archive and save changes. This method is automatically called at the end of the script.
OpenDocumentArchive::deleteIndex()
Delete an entry in the archive using its index.
OpenDocumentArchive::deleteName()
Delete an entry in the archive using its name.
OpenDocumentArchive::getDOMFromName()
Retrieve file from archive as a DOM document.
OpenDocumentArchive::getFilelist()
Retrieve file list.
OpenDocumentArchive::getManifest()
Retreive the manifest document as a ManifestDocument object.
OpenDocumentArchive::getMimeType()
Retrieve mime type of the OpenDocument archive.
OpenDocumentArchive::open()
Opens a new zip archive for reading, writing or modifying.
OpenDocumentArchive::renameIndex()
Renames an entry defined by its index.
OpenDocumentArchive::renameName()
Renames an entry defined by its name.
OpenDocumentArchive::setMimeType()
Set mime type of the OpenDocument archive.
OpenDocumentArchive::statName()
Get the details of an entry defined by its name.
OpenDocumentArchive::unchangeAll()
Undo all changes done in the archive. Always returns false!
OpenDocumentArchive::unchangeIndex()
Revert all changes done to an entry at the given index.
OpenDocumentArchive::unchangeName()
Revert all changes done to an entry with the given name.

Inherited From ZipArchive (Internal Class)

addEmptyDir ( )
addFile ( )
addFromString ( )
close ( )
deleteIndex ( )
deleteName ( )
extractTo ( )
getArchiveComment ( )
getCommentIndex ( )
getCommentName ( )
getFromIndex ( )
getFromName ( )
getNameIndex ( )
getStream ( )
locateName ( )
open ( )
renameIndex ( )
renameName ( )
setArchiveComment ( )
setCommentIndex ( )
setCommentName ( )
statIndex ( )
statName ( )
unchangeAll ( )
unchangeArchive ( )
unchangeIndex ( )
unchangeName ( )

Inherited From OpenDocumentArchive

OpenDocumentArchive::NOMANIFEST
OpenDocumentArchive::PathToManifestXml

Inherited From ZipArchive (Internal Class)

CHECKCONS = 4
CM_DEFAULT = -1
CM_DEFLATE = 8
CM_DEFLATE64 = 9
CM_IMPLODE = 6
CM_PKWARE_IMPLODE = 10
CM_REDUCE_1 = 2
CM_REDUCE_2 = 3
CM_REDUCE_3 = 4
CM_REDUCE_4 = 5
CM_SHRINK = 1
CM_STORE = 0
CREATE = 1
ER_CHANGED = 15
ER_CLOSE = 3
ER_COMPNOTSUPP = 16
ER_CRC = 7
ER_DELETED = 23
ER_EOF = 17
ER_EXISTS = 10
ER_INCONS = 21
ER_INTERNAL = 20
ER_INVAL = 18
ER_MEMORY = 14
ER_MULTIDISK = 1
ER_NOENT = 9
ER_NOZIP = 19
ER_OK = 0
ER_OPEN = 11
ER_READ = 5
ER_REMOVE = 22
ER_RENAME = 2
ER_SEEK = 4
ER_TMPOPEN = 12
ER_WRITE = 6
ER_ZIPCLOSED = 8
ER_ZLIB = 13
EXCL = 2
FL_COMPRESSED = 4
FL_NOCASE = 1
FL_NODIR = 2
FL_UNCHANGED = 8
OVERWRITE = 8

[ Top ]
Method Summary
OpenDocumentText   __construct()   Constructor method.
void   setDefaultFontFaces()   We set up some default font face declarations here.
void   setDefaultMeta()   Setup some default data for the meta.xml.
void   setDefaultStyles()   Set up some default styles.

[ Top ]
Methods
Constructor __construct  [line 103]

  OpenDocumentText __construct( [string $fullpath = null]  )

Constructor method.

Read (and if not exists create) an OpenDocument text file.

Parameters:
string   $fullpath:  Full path and name of the document

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
OpenDocumentArchive::__construct()
Constructor method.

[ Top ]
setDefaultFontFaces  [line 190]

  void setDefaultFontFaces( )

We set up some default font face declarations here.

We put the same font face declarations in the styles.xml and content.xml document.

There are two font faces declared by this method: Tahoma1 and Arial Unicode MS.


API Tags:
Access:  public

Information Tags:
Since:  0.5.3 - 10. Jul. 2007

[ Top ]
setDefaultMeta  [line 164]

  void setDefaultMeta( )

Setup some default data for the meta.xml.

We will setup some data for the meta.xml document. You can use this method and overwrite even the static given data in this method by calling the MetaFragment or DublinCoreFragment methods again.

Currently we set the following meta datas:

DublinCore:

  • The subject is set to 'A generated subject by OpenDocumentPHP.'.
  • The title is set to 'This is a generated title by OpenDocumentPHP.'.
  • The description is set to 'This is a short description by OpenDocumentPHP.'.
  • The language is set up 'en' for an english text.

(OpenDocument-)Meta: currently nothing is set here.

In your own code you can change the value very simple:

  1.      $doc new OpenDocumentText('YourFavoriteText.odt');
  2.      ...
  3.      // Retreive the DublinCoreFragment to change dublin core meta data
  4.      $dc $doc->getMeta()->getDublinCoreFragment();
  5.      // Change title to new title
  6.      $dc->setTitle'This is a new title of the document.' );
  7.      ...
  8.      // Retreive the MetaFragment to change OpenDocument meta data
  9.      $meta $doc->getMeta()->getMetaFragment();
  10.      // Change the initial creator of the document
  11.      $meta->setInitialCreator'Robert Duck' );
  12.      ...


API Tags:
Access:  public

Information Tags:
Since:  0.5.2 - 21. Mar. 2007

[ Top ]
setDefaultStyles  [line 231]

  void setDefaultStyles( )

Set up some default styles.

We define the 'Standart' and 'Heading_20_1' fonts in this method.


API Tags:
Access:  public

Information Tags:
Since:  0.5.3 - 10. Jul. 2007

[ Top ]
Constants
odmTextNamespace = 'application/vnd.oasis.opendocument.text' [line 93]

Namespace TEXT


[ Top ]

Documentation generated on Wed, 18 Jun 2008 06:31:17 +0200 by phpDocumentor 1.3.2