=head1	NAME

OpenOffice::OODoc::Meta - Access to document metadata


The OpenOffice::OODoc::Meta class is a specialist derivative of
OpenOffice::OODoc::XPath for XML members which describe the metadata
of OpenDocument (ODF) and OpenOffice.org documents.

=head2	Methods

=head3	Constructor : OpenOffice::OODoc::Meta->new(<parameters>)

        Short Form: odfMeta(<parameters>)

        See OpenOffice::OODoc::XPath->new (or odfXPath)

        Returns an OpenDocument connector allowing subsequent access to
	the metadata of a well-formed, ODF-compliant document.
	The XML member loaded by default is 'meta.xml'.


            $my meta	= odfMeta(file => 'document.odt');

        returns a new object which represents the metadata of the
        ODF document "document.odt".

=head3	addKeyword(text)

        Adds the given text to the list of document keywords if not already


            $meta->addKeyword("document management");
            $meta->addKeyword("tech watch");

=head3	creation_date()

        Without argument, returns the document's creation date in
        ISO-8601 format (i.e. the ODF-compliant date format).

        Example of returned value:


	The returned value can be converted in standard numeric time format
	with the ooTimelocal() function.

	With argument, inserts the given string (without checking) as the
        creation date. The argument, if any, must comply with the ODF
	(ISO-8601) date format. The ooLocaltime() function can be used in
	order to convert a regular Perl time() value in ODF.

	A conventional editing software should never changes this value, but
	this method allows the user to read or write it.

	See also date().

=head3	creator()

        Without argument, returns the document creator's name. The creator
	is generally the author of the last update. See also initial_creator().

        With argument, modifies the document author's name.

=head3	date()

        Without argument, returns the document's date of last modification,
        in ISO-8601 format.

        With argument, inserts the given string (without checking) as the
        last modification date. The argument, if any, must comply with the
	ODF date format (ISO-8601). The odfLocaltime() function can be used
	in order to convert a regular Perl time() value in ODF format.

	The returned value can be converted in standard numeric time format
	with the ooTimelocal() function.

=head3	description()

        Without argument, returns the contents of the document properties
        "Description" field.

        With argument, inserts the given text in the "Description" field.

=head3	editing_cycles()

        Without argument, returns the number of edit sessions (i.e. saves,
        under an ODF-compliant editing software). Or, technically, the number
	of versions.

        With argument, modifies this number without checking.

=head3	editing_duration()

        Without argument, returns the total editing time for the document,
        in ISO-8601 date/time format.

        For example, the returned string can be:


        which in this case means that the document has been edited for 2
        days, 11 hours, 27 minutes and 33 seconds.

        With argument, forces a new value into this property without

=head3	generator()

        Without argument, returns a label representing the signature of the
        software which generated the document. Example of signature:

        "OpenOffice.org/2.4$Linux OpenOffice.org_project/680m12$Build-9286"

        With argument, inserts any signature.

=head3	initial_creator()

	Like creator(), but apply to the creator of the first version of the
	document. The OOo desktop software never updates this value, but this
	method allows the user to read or write it.	

=head3	keywords()

        Without argument, returns a list of the document's keywords. In a
        list context, the result is a table where each element is a keyword.
        In a scalar context, the keywords are returned in a single character
        string, each of which is separated by a comma and a space.

        With arguments, adds a list of keywords to the existing one. The
        only checking carried out is to see if the keyword already exists,
        if so it is not added.

=head3	language()

        Without argument, returns the content of the language variable.


        With argument, changes the content of this variable without

=head3	removeKeyword(keyword)

        Removes the given keyword if it exists.

=head3	statistic()

        Without argument, returns a hash which represents the entire
        "statistics" section of the metadata. The content depends on the
        type of document.


		'meta:table-count'	=> number of tables
		'meta:image-count'	=> number of images
		'meta:object-count'	=> number of OLE objects
		'meta:page-count'	=> number of pages
		'meta:paragraph-count'	=> number of paragraphs
		'meta:word-count'	=> number of words
		'meta:character-count'	=> number of characters


		'meta:table-count'	=> number of sheets
		'meta:cell-count'	=> number of non-empty cells
		'meta:object-count'	=> number of objects (images, etc.)


            my $meta	= OpenOffice::OODoc::Meta->new("invoice.sxc");
            my %stat	= $meta->statistic;
            print 	"This invoice contains " .
            	"$stat{'meta:cell-count'} cells and "	.
            	"$stat{'meta:table-count'} pages\n";

        With arguments, you can modify (or falsify ?!) all or some of the
        statistical data and even create attributes which are not created by
        the OpenOffice.org or StarOffice software. Arguments are passed in
        pairs [key => value] and handled without checking.


            	('meta:table-count' => '4', 'status' => 'OK');

        This example forces the number of tables to 4 (whatever the reality)
        and adds an arbitrary attribute 'status' with value 'OK'.
	Note : Such forced attributes do not upset the function of
        OpenOffice.org which ignores them. They could therefore be useful in
        programs which handle documents out of reach of the end user.
        However, if such a document is then edited or updated by
        OpenOffice.org or StarOffice (using currently released versions),
        these "foreign" attributes will be lost and the software will
        replace what it considers to be the "real" values to those
        attributes it manages.

=head3	subject()

        Without argument, returns the document's subject.

        With argument, adds a new subject to the document.

=head3	title()

        Without argument, returns the document's title.

        With argument, adds a new title to the document.

=head3	user_defined()

        Returns a list of the four fields which appear in the User tab of
        the Properties dialog in OpenOffice.org. These fields are called, by
        default, "Info 1" to "Info 4". The end user can change their names
        and their content.

        The list is returned in the form of a hash of 4 elements whose
        keywords represent the field names and whose values represent their

        By supplying a similar hash of 4 elements as an argument, this
        method deletes and replaces the existing content.

        If the number of elements supplied in the hash is less than 4, the
        last fields are left untouched. If, however, the hash contains more
        than 4 elements, only the first 4 are taken into account.

=head3	version()

	Synonym of editing_cycles().

=head2	Properties

        As for OpenOffice::OODoc::XPath


Developer/Maintainer: Jean-Marie Gouarne L<http://jean.marie.gouarne.online.fr>

Contact: jmgdoc@cpan.org

Copyright 2004-2008 by Genicorp, S.A. L<http://www.genicorp.com>

Initial English version of the reference manual by Graeme A. Hunter

License: GNU Lesser General Public License v2.1