ooolib-perl-0.1.9/0000755000175000017500000000000010561734417013316 5ustar josephjosephooolib-perl-0.1.9/doc/0000755000175000017500000000000010540735705014061 5ustar josephjosephooolib-perl-0.1.9/doc/ooolib-perl-0.1.8-doc.html0000644000175000017500000004504110540735700020376 0ustar josephjoseph OpenOffice.org Perl Module (ooolib-perl)

OpenOffice.org Perl Library (ooolib-perl)

Version 0.1.8

Documentation


Table of Contents

  1. Table of Contents
  2. Information
  3. Setup and Installation
  4. Application Programming Interface (API)
  5. Library Internals

Information

Information about the ooolib-perl project. I am interested in seeing how the ooolib is being used. If you are using ooolib in a program or on your website, please email me and let me know.

Contact Information

You can contact me, Joseph Colton, at either of these addresses. For e-mail:
josephcolton@gmail.com

For mailing or visiting:
55-579 Naniloa Loop
Laie, Hawaii 96762

ooolib-perl License

ooolib-perl - This Perl Library is built to create OpenOffice.org documents.
Copyright (C) 2003-2006 Joseph Colton

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


Setup and Installation

The setup and installation for ooolib-perl is really quite easy. Because the library is written in Perl, there is no compiling. You only need to have the requirements and use the require statement in your program.

Requirements

In order to use ooolib-perl you will need to have a machine running GNU/Linux and have either the Archive::Zip module or the zip command installed. To view the resulting documents you will need to have OpenOffice.org 1.1 Beta or later.

Contents

Below are the files and directories included with the source for ooolib:

ChangeLog	This file contains information about changes to ooolib-perl
		in each version.
doc/		This is the documentation directory.
examples/	This directory contains example programs.
ooolib.pm	This is the ooolib-perl module.
README		The readme file.
TODO		This file contains information about tasks that are not yet
		completed.
mime.types	This file contains mime type information you can use with Apache, etc.

Example Programs

There are currently very few example programs. The number and use of the example programs are subject to change as the feature set of ooolib grows.


Application Programming Interface (API)

The Application Programming Interface or API is just the collection of functions you use to create programs that use ooolib.

Basic Outline

Perl scripts using ooolib need a few basic things. You need to use the module and you need to create the document by specifying what type of document you are creating. Finally you need to create the document with the generate command. This is about the shortest a script can be: #!/usr/bin/perl use ooolib; $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("author", "The Author"); $filename = $doc->oooGenerate("basic.sxw");

For you can save and use this code if you like: base_code

oooSet - Setting Properties

Sets variables used in creating and processing documents.
Synopsis:
&oooSet(NAME, <DATA>);
Description:
oooSet can only be called after oooInit. This function sets options such as the author, subject, bold, italics, etc. The first argument, NAME, refers to what is to be set. Each NAME argument has different options that are needed. Here are the current names with the that they require:
  • "title" - Takes a single string value that is used as the title of the document.
  • "author" - Takes a single string value that is used as the name of the author for the document.
  • "subject" - Takes a single string value that is used as the subject of the document.
  • "comments" - Takes a single string value that is used as the comments for the document.
  • "builddir" - Takes a single string that is supposed to contain the path for the creation of the document.
  • "keyword" - Takes a single string containing a single word that is to be added to the keywords for the document. This may be used multiple times to add multiple keywords to the document.
  • "meta[1-4]-name" - Takes a single string containing the title of a user defined variable.
  • "meta[1-4]-value" - Takes a single string containing the value of a user defined variable.
  • "cell-loc" - Takes x and y coordinates in a spreadsheet. The next oooData call will print to the resulting cell.
  • "column-width" - Takes x as the column number and a width in centimeters. (Sorry for those of you who use inches. I guess I have spent too much time in foreign countries. 1 inch = 2.54 cm.)
  • "cell-left" - Moves the writing cell one to the left.
  • "cell-right" - Moves the writing cell one to the right.
  • "cell-up" - Moves the writing cell up one.
  • "cell-down" - Moves the writing cell down one.
  • "cell-auto" - Takes x and y values. After each oooData call the writing cell is incremented by these x and y values.
  • "justify" - Takes a single argument of "right", "left", "center", or "block". The next text will then be justified accordingly.
  • "bold" - Takes a single argument of either "on" or "off".
  • "italic" - Takes a single argument of either "on" or "off".
  • "underline" - Takes a single argument of either "on" or "off".
  • "text-color" - Takes a single argument of six hex digits in the form RRGGBB where RR is the red, GG is the green, and BB is the blue for the color of the text. You may also select the following options "red", "green", "blue", "black", "white", and "default".
  • "text-bgcolor" - Takes the same argument at "text-color" except it is instead applied to the background or highlighting of the text.
  • "text-size" - Takes a single argument that must be a number for the size of the font. The following text will be written in this size. The exception is the headings.
  • "text-font" - Takes a single argument for the font. The following are valid fonts:
    • "Arial"
    • "Bitstream Vera Sans"
    • "Bitstream Vera Serif"
    • "Bookman"
    • "Courier"
    • "Courier 10 Pitch"
    • "Helvetica"
    • "Lucidabright"
    • "Lucidasans"
    • "Lucida Sans Unicode"
    • "Lucidatypewriter"
    • "Luxi Mono"
    • "Luxi Sans"
    • "Luxi Serif"
    • "Symbol"
    • "Tahoma"
    • "Times"
    • "Times New Roman"
    • "Utopia"
    • "Zapf Chancery"
    • "Zapf Dingbats"
Return Value:
On successful completion oooSet returns the string "ok". If there is a problem, oooSet will return the string "error" and an error message will be available by calling oooError.

oooData - Documents Data

Takes data and formats it for use in the document.
Synopsis:
&oooData(STYLE, TEXT);
Description:
oooData can only be called after oooInit has been called. It takes a string STYLE and a string of TEXT then uses this information to create the data in the content.xml file. The TEXT is run through the character filter oooCleanText, then the STYLE is looked up.
In some cases, the style needs to have features such as bold, italics, right, center, or block justification added. This is also handled by this function call.
This is a list of the different styles currently available:
Return Value:
Return the string "ok" on successful completion and the string "error" if there is a problem.

oooSpecial - Special Data

This function creates special types of data for documents.
Synopsis:
&oooSpecial(STYLE, <ARGS>);
Description:
oooSpecial takes a single argument for a style and then optional additional arguments required to carry out the style. Below are the current styles:
Return Value:
Return values vary, but if you get "ok" then everything worked. If you get "error" then there is a problem. All other return values also indicate things worked out correctly. For other return values see the description of the different styles.

oooGenerate - Document Creation

Creates the end document file.
Synopsis:
&oooGenerate;
&oooGenerate(FILENAME);
Description:
The oooGenerate function is either left empty or is passed a single string argument, FILENAME, that is used to determine the filename for the document being created.
In the event that a FILENAME is picked, oooGenerate will make sure the filename ends with the correct file extension. If it is not present, oooGenerate will append the correction extension and create the file.
If no FILENAME is supplied, oooGenerate will create a a name consisting of the date and the pid number of the processes running ooolib, and the correction file extension.
Return Value:
Once oooGenerate has successfully completed, it will return a string containing the complete path of the newly created document. If there is an error, oooGenerate will return the string "error" and an error message will be available by calling oooError.

oooError - Error reporting

Gives error messages to help in debugging code.
Synopsis:
&oooError;
Description:
oooError returns a string containing the last error message. If two errors are reported to oooError, it will only return the last error.
Return Value:
A string containing the last error message.

Library Internals

If you are interested in working on the inside of the library you will probably want to know a little bit about how it is setup.

Internal Variables

oooCleanText

This function prepares a text string to be included in the XML for OpenOffice.org documents.
Synopsis:
&oooCleanText(TEXT);
Description:
oooCleanText takes a string, TEXT, and replaces special characters that conflict with the text of the XML for the OpenOffice.org documents. This is the order of the substitutions:
"&" becomes "&amp;"
"'" becomes "&apos;"
"<" becomes "&lt;"
">" becomes "&gt;"
Return Value:
Once the text has been modified, the resulting text is returned.

oooWriteMeta

Writes the meta.xml file that is included in the document.
Synopsis:
&oooWriteMeta(BUILDDIR, TYPE);
Description:
The function oooWriteMeta takes two string BUILDDIR and TYPE as input and uses the information previously entered using commands like oooSet to build the meta.xml file.
Return Value:
Return "ok" on success and "error" if an error occurs.

oooWriteContests

Writes the content.xml file.
Synopsis:
&oooWriteContents(BUILDDIR, TYPE);
Description:
The function oooWriteContents takes two strings BUILDDIR and TYPE as input and uses the information previously entered using commands like oooSet and oooData to build the content.xml file.
Return Value:
Returns "ok" on success and "error" if an error occurs.

oooWriteStyles

Writes the styles.xml file.
Synopsis:
&oooWriteStyles(BUILDDIR, TYPE);
Description:
The function oooWriteStyles takes two strings BUILDDIR and TYPE as input and uses the type of document to build a styles.xml file.
Return Value:
Returns "ok" on success and "error" if an error occurs.

oooWriteMimetype

Writes the mimetype file.
Synopsis:
&oooWriteMimetype(BUILDDIR, TYPE);
Description:
The function oooWriteMimetype takes two strings BUILDDIR and TYPE as input and uses the type of document to build a mimetype file.
Return Value:
Returns "ok" on success and "error" if an error occurs.

oooWriteSettings

Writes the settings.xml file.
Synopsis:
&oooWriteSettings(BUILDDIR, TYPE);
Description:
The function oooWriteSettings takes two strings BUILDDIR and TYPE as input and uses the type of document to build a settings.xml file.
Return Value:
Returns "ok" on success and "error" if an error occurs.

oooWriteManifest

Writes the manifest file.
Synopsis:
&oooWriteManifest(BUILDDIR, TYPE);
Description:
The function oooWriteManifest takes two strings BUILDDIR and TYPE as input and builds the manifest.xml file.
Return Value:
Returns "ok" on success and "error" if an error occurs.

oooTimeStamp

Returns a time stamp.
Synopsis:
&oooTimeStamp;
Description:
The oooTimeStamp function calculates the date and returns a string indicating the date.
Return Value:
A string in the form YYYY-MM-DDTHH:MM:SS.

oooDateTime

Returns the date and time: yyyy, mm, dd, hh, mm, ss
Synopsis:
&oooDateTime;
Description:
Gets the date and time information, then returns the results.
Return Value:
Returns an array (year, month, day, hour, minute, second)

oooCellUpdate

Updates max values and current values for x and y
Synopsis:
&oooCellUpdate;
Description:
The function oooCellUpdate is called after data is entered in a cell. It updates the cell location if the cell-auto x and y have been set. Next it calls oooCellCheck to make sure the resulting x and y values are still valid.
Return Value:
None

oooCellCheck

Tests to make sure the x and y values are legal
Synopsis:
&oooCellCheck;
Description:
Checks and makes sure the x ($cellhash{x}) and y ($cellhash{y}) values are between the maximum ($MAXX, $MAXY) and minimum ($MINX, $MINY) allowed values. If they are too high or too low they are set to the max or min value.
Return Value:
None

oooStyleName

Returns the name of the style to use
Synopsis:
&oooStyleName(STYLE);
Description:
The oooStyleName function keeps track of which combinations of bold, italics, underline, right, left, center, and block justification have auto style aliases. If there is one it is returned, if not it is created and returned.
Return Value:
Returns a string that contains the style that should be used for the text.
ooolib-perl-0.1.9/TODO0000644000175000017500000000014610540735046014003 0ustar josephjosephThis is the TODO for the ooolib-perl project. - Complete ooolib-perl rewrite as a module with class. ooolib-perl-0.1.9/REQUIREMENTS0000644000175000017500000000171210166315655015165 0ustar josephjosephThe OpenOffice.org Utility Library has a small set of requirements. Each requirement needs to be installed correctly for ooolib to work. zip requirement: You are either required to install the zip command or the Archive::Zip Perl module. The default is to install the Archive::Zip Perl module as of ooolib version 0.1.7. See http://search.cpan.org/~nedkonz/Archive-Zip-1.14/ for more information abot Archive::Zip. Zip Command If you choose the zip command option, first make sure that you have the zip command installed. See http://www.info-zip.org/pub/infozip/ for more information. Then, when you create documents, add the "zip" option like these: $doc = new ooolib("sxc", "zip"); $doc = new ooolib("sxw", "zip"); Archive::Zip If you decide to use the default method, you will need to make sure Archive::Zip is installed. You can either use the CPAN shell, download and manually install, or for Gentoo users like me, use the command "emerge Archive-Zip". ooolib-perl-0.1.9/README0000644000175000017500000000231710540734610014171 0ustar josephjosephREADME file OpenOffice.org Perl Library (ooolib-perl) This Perl Library is being created so that Perl users will have the ability to create OpenOffice.org documents. Originally I was faced with the problem of creating spreadsheet files from a Perl CGI program. Since I could not find a library that would do the task, I decided to write my own. This is ooolib. I hope that ooolib-perl will satisify your programming needs. If you have any comments or suggestions, feel free to contact me at josephcolton@gmail.com Additional documentation is available in the doc/ directory. Files included with ooolib-perl: ChangeLog This file contains information about changes to ooolib in each version. doc/ This is the documentation directory. examples/ This directory contains example programs. ooolib.pm This is the ooolib-perl module. README This file. REQUIREMENTS This contains information about requirements for installation and running ooolib-perl. TODO This file contains information about tasks that are not yet completed. ooolib-perl-0.1.9/ooolib.pm0000644000175000017500000023154510561734415015147 0ustar josephjoseph# ooolib - This perl library is built to create OpenOffice.org documents. # Copyright (C) 2003 Joseph Colton # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # You can contact me by email at josephcolton@gmail.com package ooolib; use Carp; # API Function Calls sub oooData; # Formats input with current options sub oooSpecial; # Adds special data to the document: brakes, tables? sub oooSet; # arg1 variable name, arg2 value/data sub oooGenerate; # arg1 filename|null returns filename sub oooError; # returns last error message # Internal function calls sub oooWriteMeta; # Writes the meta.xml file sub oooWriteContent; # Writes the content.xml file sub oooWriteStyles; # Writes the styles.xml file sub oooWriteMimetype; # Writes the mimetype file sub oooWriteSettings; # Writes the settings file sub oooWriteManifest; # Writes the META-INF/manifest.xml file sub oooTimeStamp; # Returns a timestamp of the form yyyy-mm-ddThh:mm:ss sub oooDateTime; # Returns the date and time: yyyy, mm, dd, hh, mm, ss sub oooCleanText; # Replaces special characters in a string sub oooCellUpdate; # Updates max values and current values for x and y sub oooCellCheck; # Tests to make sure the x and y values are legal sub oooStyleName; # Returns the name of the style to use # Library internal variables my($MINX, $MINY, $MAXX, $MAXY); $MINX = $MINY = 1; $MAXX = $MAXY = 32000; my($version, %options, %cellhash, @documenttext, @keywords, @fontdecls); $version="0.1.9"; ################## # Function Calls # ################## sub new { my($type); my($package, $newtype, $opt) = @_; $type = $newtype; $type = "sxw" unless ($type); if ($opt) {if ($opt =~ /debug/) {$options{debug} = 1;}} if ($opt) {if ($opt =~ /zip/) {$options{zip} = 1;}} # Set default values $cellhash{x} = 1; $cellhash{y} = 1; $cellhash{xmax} = 1; $cellhash{ymax} = 1; # Formatting $options{"nextstyle"} = 1; $options{"nextstyle table-column"} = 2; $options{"nextstyle table-cell"} = 1; $options{nextlist} = 1; $options{justify} = "left"; $options{bold} = "off"; $options{italic} = "off"; $options{underline} = "off"; $options{textcolor} = "000000"; $options{textbgcolor} = "FFFFFF"; $options{textsize} = "12"; $options{textsize_default} = "12"; $options{textsize_min} = "6"; $options{textsize_max} = "96"; # Default Font push(@fontdecls, ""); $options{fontname} = "Times"; $options{"font-decl Times"} = $options{fontname}; # Used for auto-incrementing cells after giving values $cellhash{xauto} = 0; $cellhash{yauto} = 0; # User defined meta variables $options{"info1 name"} = "Info 1"; $options{"info2 name"} = "Info 2"; $options{"info3 name"} = "Info 3"; $options{"info4 name"} = "Info 4"; # Set all knowns $options{type} = $type; $options{time} = time; $options{pid} = $$; bless \$package; } sub ooolib_sxc_cell_StyleName { # Uses these numbers to keep track of which styles have been created my(@prop); # Default style if ($options{bold} ne "on" && $options{italic} ne "on" && $options{textcolor} eq "000000") {return "ro1";} if ($options{bold} eq "on") {push(@prop, "fo:font-weight=\"bold\"");} if ($options{italic} eq "on") {push(@prop, "fo:font-style=\"italic\"");} if ($options{textcolor} ne "000000") {push(@prop, "fo:color=\"#$options{textcolor}\"");} my($propline) = join(" ", @prop); if ($option{"cell-style $propline"}) {return $option{"cell-style $propline"};} my($num) = $options{"nextstyle table-cell"}; $options{"nextstyle table-cell"}++; my($style) = "ce$num"; push(@ooolib_sxc_cell_styles, ""); push(@ooolib_sxc_cell_styles, ""); push(@ooolib_sxc_cell_styles, ""); return $style; } sub oooStyleName { # Returns the name of the style to use my($self) = shift(@_); my($style) = @_; my($i, $b, $u, $j, $idx, $stylenum); my($it, $bt, $ut, $jt, $prop); my($tc, $tb, $tct, $tbt); # Text color/background my($ts, $tst); # text size tag my($fn, $fnt); # font name tag # Uses these numbers to keep track of which styles have been created $j = $options{justify}; $b = $options{bold}; $i = $options{italic}; $u = $options{underline}; $tc = $options{textcolor}; $tb = $options{textbgcolor}; $ts = $options{textsize}; $fn = $options{fontname}; if ($style =~ /^h/ && $j eq "left") { return $style; } if ($j eq "left" && $b eq "off" && $i eq "off" && $u eq "off" && $tc eq "000000" && $tb eq "FFFFFF" && $ts eq $options{textsize_default} && $fn eq "Times") { # Nothing special needs to be done return $style; } # A style needs to be looked up or created $idx = "$style $j $b $i $u $tc $tb $ts $fn"; if ($style =~ /^h/) {$idx = "$style $j";} if ($options{$idx}) {return $options{$idx};} $stylenum = "P$options{nextstyle}"; $options{nextstyle}++; $options{$idx} = $stylenum; if ($j eq "left") {$jt = "fo:text-align=\"start\" style:justify-single-word=\"false\" ";} if ($j eq "right") {$jt = "fo:text-align=\"end\" style:justify-single-word=\"false\" ";} if ($j eq "center") {$jt = "fo:text-align=\"center\" style:justify-single-word=\"false\" ";} if ($j eq "block") {$jt = "fo:text-align=\"justify\" style:justify-single-word=\"false\" ";} if ($options{bold} eq "on") { $bt = "fo:font-weight=\"bold\" style:font-weight-asian=\"bold\" style:font-weight-complex=\"bold\" "; } else { $bt = ""; } if ($options{italic} eq "on") { $it = "fo:font-style=\"italic\" style:font-style-asian=\"italic\" style:font-style-complex=\"italic\" "; } else { $it = ""; } if ($options{underline} eq "on") { $ut = "style:text-underline=\"single\" style:text-underline-color=\"font-color\" "; } else { $ut = ""; } if ($tc ne "000000") { $tct = "fo:color=\"#$tc\" "; } else { $tct = ""; } if ($tb ne "FFFFFF") { $tbt = "style:text-background-color=\"#$tb\" "; } else { $tbt = ""; } if ($ts ne $options{textsize_default}) { $tst = "fo:font-size=\"${ts}pt\" "; } else { $tst = ""; } $fnt = ""; if ($fn) {$fnt = "style:font-name=\"${fn}\" ";} if ($style =~ /^h/) { push(@autostyles, ""); push(@autostyles, ""); push(@autostyles, ""); } else { push(@autostyles, ""); push(@autostyles, ""); push(@autostyles, ""); } return $stylenum; } sub oooSpecial { # Adds special data to the document: brakes, tables? my($self) = shift(@_); my($style) = shift(@_); unless($style) { $errormessage = "This function requires at least one argument"; return "error"; } # Styles if ($style eq "pagebreak") { if ($options{pagebreak}) { my($stylenum); $stylenum = $options{pagebreak}; push(@documenttext, ""); } else { my($stylenum); $stylenum = "P$options{nextstyle}"; $options{nextstyle}++; $options{pagebreak} = $stylenum; push(@autostyles, ""); push(@autostyles, ""); push(@autostyles, ""); push(@documenttext, ""); } return "ok"; } elsif ($style eq "list-ordered") { my($stylenum, $listnum, $text); ($listnum, $text) = @_; $text = &oooCleanText($text); if ($listnum =~ /^L[0-9]+$/) { # Good listnum $stylenum = $options{$listnum}; unless($stylenum) { $errormessage = "Invalid list number \"$listnum\"."; return "error"; } push(@documenttext, ""); push(@documenttext, ""); push(@documenttext, "$text"); push(@documenttext, ""); push(@documenttext, ""); return $listnum; } else { # Needs a listnum $stylenum = "P$options{nextstyle}"; $options{nextstyle}++; $listnum = "L$options{nextlist}"; $options{nextlist}++; $options{$listnum} = $stylenum; # The style push(@autostyles, ""); # The list information push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); push(@autolists, ""); # Text for the document push(@documenttext, ""); push(@documenttext, ""); push(@documenttext, "$text"); push(@documenttext, ""); push(@documenttext, ""); return $listnum; } } $errormessage = "I did not understand the oooSpecial style"; return "error"; } sub oooData { my($self) = shift(@_); my($style, $origtext) = @_; my($text, $stylename); unless($style) { $errormessage = "This function requires at least two arguments"; return "error"; } if ($origtext) { $text = &oooCleanText($origtext); } else { $text = ""; } if ($style eq "h") { $stylename = &oooStyleName("Heading"); push(@documenttext, "$text"); } elsif ($style =~ /^h([1-9])/) { $stylename = &oooStyleName("Heading $1"); push(@documenttext, "$text"); } elsif ($style eq "default") { $stylename = &oooStyleName("Standard"); if ($text) { # Default Text push(@documenttext, "$text"); } else { # Blank line push(@documenttext, ""); } } elsif ($style eq "textbody") { # textbody does some special formatting stuff. my(@paragraphs, $paragraph, @lines, $line); $stylename = &oooStyleName("Text body"); if ($text) { # A paragraph with text @paragraphs = split(/\n/, $text); foreach $paragraph (@paragraphs) { # Send Begin Paragraph tag unless($paragraph) {next;} push(@documenttext, ""); @lines = split(/\. +/, $paragraph); $line = join(". ", @lines); push(@documenttext, $line); push(@documenttext, ""); } } else { # This is a blank paragraph tag. push(@documenttext, ""); } } elsif ($style eq "cell-float") { my($x, $y); $x = $cellhash{x}; $y = $cellhash{y}; $cellhash{"$x $y type"} = "float"; $cellhash{"$x $y value"} = $text; $cellhash{"$x $y format"} = ""; $cellhash{"$x $y style"} = &ooolib_sxc_cell_StyleName; &oooCellUpdate; } elsif ($style eq "cell-text") { my($x, $y); $x = $cellhash{x}; $y = $cellhash{y}; $cellhash{"$x $y type"} = "text"; $cellhash{"$x $y value"} = $text; $cellhash{"$x $y format"} = ""; $cellhash{"$x $y style"} = &ooolib_sxc_cell_StyleName; &oooCellUpdate; } elsif ($style eq "cell-formula") { # cell-formula code from Vladimir Vuksan my($x, $y); $x = $cellhash{x}; $y = $cellhash{y}; $cellhash{"$x $y type"} = "formula"; $cellhash{"$x $y value"} = $text; $cellhash{"$x $y format"} = ""; $cellhash{"$x $y style"} = &ooolib_sxc_cell_StyleName; &oooCellUpdate; } elsif ($style eq "cell-skip") { # Does not do anything to the cell, just skips it &oooCellUpdate; } elsif ($style eq "anothertype") { # Add more types here. } return "ok"; } sub oooError { # returns last error message if any if ($errormessage) { return $errormessage; } else { return "No error messages."; } } sub oooCellUpdate { # Updates max values and current values for x and y if ($cellhash{x} > $cellhash{xmax}) {$cellhash{xmax} = $cellhash{x};} if ($cellhash{y} > $cellhash{ymax}) {$cellhash{ymax} = $cellhash{y};} $cellhash{x} += $cellhash{xauto}; $cellhash{y} += $cellhash{yauto}; &oooCellCheck; } sub oooCellCheck { # Tests to make sure the x and y values are legal if ($cellhash{x} < $MINX) {$cellhash{x} = $MINX;} if ($cellhash{y} < $MINY) {$cellhash{y} = $MINY;} if ($cellhash{x} > $MAXX) {$cellhash{x} = $MAXX;} if ($cellhash{y} > $MAXY) {$cellhash{y} = $MAXY;} } sub oooCleanText { my($text) = @_; $text =~ s/\&/\&/g; $text =~ s/'/\'/g; $text =~ s/\"/\"/g; # Path from Vladimir Vuksan $text =~ s//\>/g; $text =~ s/\t//g; $text =~ s/([^\x20-\x7F])/'&#' . ord($1) . ';'/gse; # from http://perl-xml.sourceforge.net/faq/#encoding_conversion return $text; } sub oooSet { # Set variables in the options hash $self = shift(@_); my($name) = shift(@_); unless($name) { $errormessage = "Usage: \&oooSet(\"name\", arg2, arg3, etc.);"; return "error"; } if ($name eq "title") { my($value) = shift(@_); $options{title} = &oooCleanText($value); } elsif ($name eq "author") { my($value) = shift(@_); $options{author} = &oooCleanText($value); } elsif ($name eq "subject") { my($value) = shift(@_); $options{subject} = &oooCleanText($value); } elsif ($name eq "comments") { my($value) = shift(@_); $options{comments} = &oooCleanText($value); } elsif ($name eq "builddir") { my($value) = shift(@_); $options{builddir} = $value; } elsif ($name eq "keyword") { my($value); while(@_) { $value = shift(@_); push(@keywords, &oooCleanText($value)); } } elsif ($name =~ /^meta([1-4])-name$/) { my($value) = shift(@_); $options{"info$1 name"} = &oooCleanText($value); } elsif ($name =~ /^meta([1-4])-value$/) { my($value) = shift(@_); $options{"info$1 value"} = &oooCleanText($value); } elsif ($name eq "cell-loc") { # Set the writing cell my($x, $y) = @_; if ($x =~ /[a-zA-Z]/) { ($x, $y) = &ooosxcCellLocConv($x); } $cellhash{x} = $x; $cellhash{y} = $y; &oooCellCheck; } elsif ($name eq "column-width") { # Set width of column my($col) = shift(@_); my($width) = shift(@_); $cellhash{"column $col width"} = $width; } elsif ($name eq "cell-left") { # Subtract 1 from x $cellhash{x}--; &oooCellCheck; } elsif ($name eq "cell-right") { # Add 1 to x $cellhash{x}++; &oooCellCheck; } elsif ($name eq "cell-up") { # Subtract 1 from y $cellhash{y}--; &oooCellCheck; } elsif ($name eq "cell-down") { # Add 1 to y $cellhash{y}++; &oooCellCheck; } elsif ($name eq "cell-auto") { # Set the auto-increment values. my($x, $y) = @_; $cellhash{xauto} = $x; $cellhash{yauto} = $y; } elsif ($name eq "justify") { # Set the justification of the text my($value) = @_; if ($value eq "right" || $value eq "left" || $value eq "center" || $value eq "block") { $options{justify} = $value; } } elsif ($name eq "bold") { # Adjust the bold properties my($value) = @_; if ($value eq "on" || $value eq "off") { $options{bold} = $value; } } elsif ($name eq "italic") { # Adjust the italic properties my($value) = @_; if ($value eq "on" || $value eq "off") { $options{italic} = $value; } } elsif ($name eq "underline") { # Adjust the underline properties my($value) = @_; if ($value eq "on" || $value eq "off") { $options{underline} = $value; } } elsif ($name eq "text-color") { # Set the text color RRGGBB my($value) = @_; if ($value =~ /^[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]$/) { $options{textcolor} = $value; return "ok"; } else { if ($value eq "default") { # Defaults back to black $options{textcolor} = "000000"; } elsif ($value eq "red") { # red = FF0000 $options{textcolor} = "FF0000"; } elsif ($value eq "green") { # Green = 00FF00 $options{textcolor} = "00FF00"; } elsif ($value eq "blue") { # Blue eq 0000FF $options{textcolor} = "0000FF"; } elsif ($value eq "black") { # Defaults back to black $options{textcolor} = "000000"; } elsif ($value eq "white") { # White = FFFFFF $options{textcolor} = "FFFFFF"; } else { $errormessage = "Is \"$value\" a color?"; return "error"; } return "ok"; } } elsif ($name eq "text-bgcolor") { # Set the background color for text RRGGBB my($value) = @_; if ($value =~ /^[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]$/) { $options{textbgcolor} = $value; return "ok"; } else { if ($value eq "default") { # Defaults back to black $options{textbgcolor} = "000000"; } elsif ($value eq "red") { # red = FF0000 $options{textbgcolor} = "FF0000"; } elsif ($value eq "green") { # Green = 00FF00 $options{textbgcolor} = "00FF00"; } elsif ($value eq "blue") { # Blue eq 0000FF $options{textbgcolor} = "0000FF"; } elsif ($value eq "black") { # Defaults back to black $options{textbgcolor} = "000000"; } elsif ($value eq "white") { # White = FFFFFF $options{textbgcolor} = "FFFFFF"; } else { $errormessage = "Is \"$value\" a color?"; return "error"; } return "ok"; } } elsif ($name eq "text-size") { my($value) = @_; if ($value =~ /^[0-9]+$/) { if ($value >= $options{textsize_min} && $value <= $options{textsize_max}) { $options{textsize} = $value; } } else { if ($value eq "default") { $options{textsize} = $options{textsize_default}; } else { $errormessage = "Only digits are allowed, not \"$value\"."; return "error"; } } } elsif ($name eq "text-font") { my($value) = @_; if ($options{"font-decl $value"}) { $options{fontname} = $options{"font-decl $value"}; } else { if ($value eq "Arial") { push(@fontdecls, ""); $options{fontname} = "Arial"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Bitstream Vera Sans") { push(@fontdecls, ""); $options{fontname} = "Bitstream Vera Sans"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Bitstream Vera Serif") { push(@fontdecls, ""); $options{fontname} = "Bitstream Vera Serif"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Bookman") { push(@fontdecls, ""); $options{fontname} = "Bookman"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Courier") { push(@fontdecls, ""); $options{fontname} = "Courier"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Courier 10 Pitch") { push(@fontdecls, ""); $options{fontname} = "Courier 10 Pitch"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Helvetica") { push(@fontdecls, ""); $options{fontname} = "Helvetica"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Lucidabright") { push(@fontdecls, ""); $options{fontname} = "Lucidabright"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Lucidasans") { push(@fontdecls, ""); $options{fontname} = "Lucidasans"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Lucida Sans Unicode") { push(@fontdecls, ""); $options{fontname} = "Lucida Sans Unicode"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Lucidatypewriter") { push(@fontdecls, ""); $options{fontname} = "Lucidatypewriter"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Luxi Mono") { push(@fontdecls, ""); $options{fontname} = "Luxi Mono"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Luxi Sans") { push(@fontdecls, ""); $options{fontname} = "Luxi Sans"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Luxi Serif") { push(@fontdecls, ""); $options{fontname} = "Luxi Serif"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Symbol") { push(@fontdecls, ""); $options{fontname} = "Symbol"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Tahoma") { push(@fontdecls, ""); $options{fontname} = "Tahoma"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Times") { push(@fontdecls, ""); $options{fontname} = "Times"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Times New Roman") { push(@fontdecls, ""); $options{fontname} = "Times New Roman"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Utopia") { push(@fontdecls, ""); $options{fontname} = "Utopia"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Zapf Chancery") { push(@fontdecls, ""); $options{fontname} = "Zapf Chancery"; $options{"font-decl $value"} = $options{fontname}; } if ($value eq "Zapf Dingbats") { push(@fontdecls, ""); $options{fontname} = "Zapf Dingbats"; $options{"font-decl $value"} = $options{fontname}; } } } return "ok"; } sub oooGenerate { # Create the document and return a filename my($self) = shift(@_); my($filename) = @_; my($cdloc, $builddir, $type); $builddir = $options{builddir}; $type = $options{type}; unless($builddir) { $errormessage = "Builddir not selected"; return "error"; } unless($type) { $errormessage = "Document type not selected"; return "error"; } if ($filename) { my(@parts) = split(/\./, $filename); my($ext) = pop(@parts); if ($ext ne $options{type}) { $filename = "$filename.$type"; } } else { my($time, $pid); $time = time; $pid = $$; $filename = "${time}${pid}.${type}"; } # Create the files if ($options{debug}) { print "Writing XML files in \"$builddir\"\n"; } &oooWriteMimetype($builddir, $type); &oooWriteContent($builddir, $type); &oooWriteStyles($builddir, $type); &oooWriteMeta($builddir, $type); &oooWriteSettings($builddir, $type); &oooWriteManifest($builddir, $type); $cdloc = "cd $builddir"; if ($options{debug}) {print "Building $type file from XML\n";} # Decide which method to use. zip command or Perl Module. if ($options{zip}) { # You will be required to pass the option zip to use the zip command system("$cdloc; zip -r '$filename' mimetype > /dev/null 2> /dev/null"); system("$cdloc; zip -r '$filename' content.xml > /dev/null 2> /dev/null"); system("$cdloc; zip -r '$filename' styles.xml > /dev/null 2> /dev/null"); system("$cdloc; zip -r '$filename' meta.xml > /dev/null 2> /dev/null"); system("$cdloc; zip -r '$filename' settings.xml > /dev/null 2> /dev/null"); system("$cdloc; zip -r '$filename' META-INF/manifest.xml > /dev/null 2> /dev/null"); } else { # The Archive::Zip perl module is now the default use Archive::Zip; my $zip = Archive::Zip->new(); $zip->addFile("$builddir/mimetype", 'mimetype'); $zip->addFile("$builddir/content.xml", 'content.xml'); $zip->addFile("$builddir/styles.xml", 'styles.xml'); $zip->addFile("$builddir/meta.xml", 'meta.xml'); $zip->addFile("$builddir/settings.xml", 'settings.xml'); $zip->addFile("$builddir/META-INF/manifest.xml", 'META-INF/manifest.xml'); $zip->writeToFileNamed("$builddir/$filename"); } # Clean up if ($options{debug}) { print "Skipping Clean-up\n"; } else { unlink("$builddir/mimetype"); unlink("$builddir/content.xml"); unlink("$builddir/styles.xml"); unlink("$builddir/meta.xml"); unlink("$builddir/settings.xml"); unlink("$builddir/META-INF/manifest.xml"); rmdir("$builddir/META-INF"); } # Return the filename return "$builddir/$filename"; } # SXC specific function calls sub ooosxcCellLocConv_old { # Convert A1 to 1,1 my($id) = @_; my($xstr, $ystr, @xarray); my($x, $y, $ch); $id =~ tr/[a-z]/[A-Z]/; $x = 0; if($id =~ /([A-Z]+)([0-9]+)/) { $xstr = $1; $ystr = $2; @xarray = split(//, $xstr); while (@xarray) { $ch = shift(@xarray); # I forgot how to do this in one line. if ($ch eq "A") {$x += 1;} if ($ch eq "B") {$x += 2;} if ($ch eq "C") {$x += 3;} if ($ch eq "D") {$x += 4;} if ($ch eq "E") {$x += 5;} if ($ch eq "F") {$x += 6;} if ($ch eq "G") {$x += 7;} if ($ch eq "H") {$x += 8;} if ($ch eq "I") {$x += 9;} if ($ch eq "J") {$x += 10;} if ($ch eq "K") {$x += 11;} if ($ch eq "L") {$x += 12;} if ($ch eq "M") {$x += 13;} if ($ch eq "N") {$x += 14;} if ($ch eq "O") {$x += 15;} if ($ch eq "P") {$x += 16;} if ($ch eq "Q") {$x += 17;} if ($ch eq "R") {$x += 18;} if ($ch eq "S") {$x += 19;} if ($ch eq "T") {$x += 20;} if ($ch eq "U") {$x += 21;} if ($ch eq "V") {$x += 22;} if ($ch eq "W") {$x += 23;} if ($ch eq "X") {$x += 24;} if ($ch eq "Y") {$x += 25;} if ($ch eq "Z") {$x += 26;} # Increment the log if (@xarray) {$x *= 26;} } $y = $ystr+0; } return ($x, $y); } sub ooosxcCellLocConv { # Convert A1 to 1,1 # Contributed by Nilton Castillo my($id) = @_; my($xstr, $ystr, @xarray); my($x, $y, $ch); $id =~ tr/[a-z]/[A-Z]/; if($id =~ /([A-Z]+)([0-9]+)/) { ($xstr,$ystr) = ($1,$2); @xarray = split(//, $xstr); while (my $ch = shift @xarray) { $x *= 26; $x += ord($ch)-64; } $y = $ystr+0; } return ($x, $y); } sub ooosxcCellLocation { # Set the writing cell my($self) = shift(@_); my($x, $y) = @_; $cellx=$x; $celly=$y; if ($cellx <= 0) {$cellx = 1;} if ($celly <= 0) {$celly = 1;} } sub ooosxcCellLeft { # Subtract 1 from cellx $cellx--; if ($cellx <= 0) {$cellx = 1;} } sub ooosxcCellRight { # Add 1 to cellx $cellx++; } sub ooosxcCellUp { # Subtract 1 from celly $celly--; if ($celly <= 0) {$celly = 1;} } sub ooosxcCellDown { # Add 1 to celly $celly++; } # Functions to write files sub oooWriteMimetype { # This writes the mimetype file my($mimefile, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} $mimefile = "$builddir/mimetype"; if ($options{debug}) {print " $mimefile\n";} # Open file for writing open(DATA, "> $mimefile"); if ($type eq "sxw") { print DATA "application/vnd.sun.xml.writer"; } elsif ($type eq "sxc") { print DATA "application/vnd.sun.xml.calc"; } close(DATA); } sub oooWriteContent { # Writes the content.xml file my($contentfile, $line, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} $contentfile = "$builddir/content.xml"; if ($options{debug}) {print " $contentfile\n";} # Open file for writing open(DATA, "> $contentfile"); if ($type eq "sxw") { # Encoding information print DATA "\n"; # DOCTYPE information print DATA ""; # Information about reading this file print DATA ""; # No scripts print DATA ""; # Fonts if (@fontdecls) { print DATA ""; foreach $line (@fontdecls) { if ($options{debug}) { print DATA "$line\n"; } else { print DATA "$line"; } } print DATA ""; } # Styles line bold, center, etc. if (@autostyles) { my($autostyle); print DATA ""; foreach $autostyle (@autostyles) { if ($options{debug}) { print DATA "$autostyle\n"; } else { print DATA "$autostyle"; } } foreach $autostyle (@autolists) { if ($options{debug}) { print DATA "$autostyle\n"; } else { print DATA "$autostyle"; } } print DATA ""; } else { # No automatic styles print DATA ""; } # Body of context print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; # Text if (@documenttext) { foreach $line (@documenttext) { if ($options{debug}) { print DATA "$line\n"; } else { print DATA "$line"; } } } else { print DATA ""; } print DATA ""; print DATA ""; } elsif ($type eq "sxc") { # Encoding information print DATA "\n"; # DOCTYPE information print DATA ""; # Information about decoding XML print DATA ""; # Script information tag? print DATA ""; # Fonts if (@fontdecls) { print DATA ""; foreach $line (@fontdecls) { if ($options{debug}) { print DATA "$line\n"; } else { print DATA "$line"; } } print DATA ""; } # Styles print DATA ""; my($x, $y); # table-column styles print DATA ""; print DATA ""; print DATA ""; # Default values my($columnwidth) = "2.267"; for($x=1;$x<=$cellhash{xmax};$x++) { my($width) = $cellhash{"column $x width"}; unless($width) {$width = $columnwidth;} if ($width ne $columnwidth) { # Create a new style my($num) = $options{"nextstyle table-column"}; $options{"nextstyle table-column"}++; my($width) = sprintf("%5.3f",$width); print DATA ""; print DATA ""; print DATA ""; $cellhash{"column $x style"} = "co$num"; } else { $cellhash{"column $x style"} = "co1"; } } # table-row styles print DATA ""; print DATA ""; print DATA ""; # table styles print DATA ""; print DATA ""; print DATA ""; # table-cell styles if (@ooolib_sxc_cell_styles) { foreach $line (@ooolib_sxc_cell_styles) { print DATA $line; } } print DATA ""; # Beginning of document content print DATA ""; print DATA ""; # First tell the document what each of the column style codes are. for($x=1;$x<=$cellhash{xmax};$x++) { # Each Column my($style) = $cellhash{"column $x style"}; print DATA ""; } # Row by row print the cells for($y=1;$y<=$cellhash{ymax};$y++) { # One column cell at a time down the row print DATA ""; for($x=1;$x<=$cellhash{xmax};$x++) { # Load information about the cell my($celltype) = $cellhash{"$x $y type"}; my($value) = $cellhash{"$x $y value"}; my($style) = $cellhash{"$x $y style"}; unless($style) {$style = "ro1";} if ($celltype eq "text") { print DATA ""; print DATA "$value"; print DATA ""; } elsif ($celltype eq "float") { print DATA ""; print DATA "$value"; print DATA ""; } elsif ($celltype eq "formula") { # cell-formula code from Vladimir Vuksan print DATA ""; print DATA ""; print DATA ""; } else { print DATA ""; } } print DATA ""; } # Closing document print DATA ""; print DATA ""; print DATA ""; } close(DATA); } sub oooWriteMeta { # Writes the meta.xml file my($metafile, $keyword, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} $metafile = "$builddir/meta.xml"; if ($options{debug}) {print " $metafile\n";} $metadate = &oooTimeStamp; open(DATA, "> $metafile"); # Encoding Information print DATA ""; # DOCTYPE line print DATA ""; # Information about decoding the document and XML print DATA ""; # Beginning of the meta information print DATA ""; print DATA "ooolib $version Generator"; # Load information from hash to local variables my($title, $comments, $subject, $author); $title = $options{title}; $comments = $options{comments}; $subject = $options{subject}; $author = $options{author}; $type = $options{type}; print DATA "$title"; print DATA "$comments"; print DATA "$subject"; print DATA "$author"; print DATA "$metadate"; print DATA "$author"; print DATA "$metadate"; print DATA ""; foreach $keyword (@keywords) { print DATA "$keyword"; } print DATA ""; # Document Language print DATA "en-US"; # This is the document version number print DATA "1"; # Time the document has been worked on. print DATA "PT0S"; # This is user defined variables. my($i); for ($i=1;$i<=4;$i++) { my($name, $value); if ($options{"info$i value"}) { $name = $options{"info$i name"}; $value = $options{"info$i value"}; print DATA "$value"; } else { $name = $options{"info$i name"}; print DATA ""; } } # Statistical Data if ($type eq "sxw") { print DATA ""; # For text } elsif ($type eq "sxc") { my($cellcount) = $cellhash{ymax} * $cellhash{xmax}; print DATA ""; # For spreadsheets } print DATA ""; print DATA ""; close(DATA); } sub oooWriteStyles { # Writes the styles.xml file my($stylefile, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} $stylefile = "$builddir/styles.xml"; if ($options{debug}) {print " $stylefile\n";} open(DATA, "> $stylefile"); if ($type eq "sxw") { print DATA "\n"; print DATA ""; print DATA ""; if (@fontdecls) { print DATA ""; foreach $line (@fontdecls) { if ($options{debug}) { print DATA "$line\n"; } else { print DATA "$line"; } } print DATA ""; } print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; } elsif ($type eq "sxc") { print DATA "\n"; print DATA ""; print DATA ""; if (@fontdecls) { print DATA ""; foreach $line (@fontdecls) { if ($options{debug}) { print DATA "$line\n"; } else { print DATA "$line"; } } print DATA ""; } print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "\$"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "-"; print DATA "\$"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "???"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "Page 1"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "??? (???)"; print DATA ""; print DATA ""; print DATA ""; # Date my($yyyy, $mm, $dd, $h, $m, $s) = &oooDateTime; print DATA "${yyyy}/${mm}/${dd}, ${h}:${m}:${s}"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "Page 1 / 99"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA ""; } close(DATA); } sub oooWriteSettings { # Writes the settings.xml file my($setfile, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} $setfile = "$builddir/settings.xml"; if ($options{debug}) {print " $setfile\n";} open(DATA, "> $setfile"); if ($type eq "sxw") { print DATA "\n"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "0"; print DATA "0"; print DATA "19846"; print DATA "10691"; print DATA "true"; print DATA "false"; print DATA "false"; print DATA "false"; print DATA ""; print DATA ""; print DATA "view2"; print DATA "3002"; print DATA "3002"; print DATA "0"; print DATA "0"; print DATA "19844"; print DATA "10689"; print DATA "0"; print DATA "100"; print DATA "false"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "false"; print DATA "false"; print DATA "1"; print DATA "0"; print DATA "false"; print DATA "false"; print DATA "false"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA ""; print DATA "fAL+/0VQU09OIFBNLTc3MEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARVBTT04gUE0tNzcwQwAAAAAAAAAAAAAAAAAAAAAAAAAWAAEAwgEAAAAAAAABAAhSAAAEdAAAM1ROVwEACABFUFNPTiBQTS03NzBDAAAAAAAAAAAAAAAAAAAAAAAAAAAEJAKUACYBD4uABwEACQCaCzQIAAABAAcAaAECAAAAaAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAABAAAAIQEAAAAAAAAAAAAARExMTmFtZTE2PUVQSUdVSjNRLkRMTAAAAAAAAAAAAABETExOYW1lMzI9RVBJREEyMzAuRExMAAAAAAAAAAAAAEVQU09OIFBNLTc3MEMAAAAAAAAAAAAAAAAAAAAAAAAAAAMCAGgBaAEBAAAAAAAAAAABAAAJAEwLgQ9MC4EPZABoAWgBoAtxECoAKgAqAMYAoAtxECoAKgAqAMYAAAAAABQAAAAAAAAAAAAyAAAA/wAAAAAAAAAAAAAAAAABAAAAAAACAAAAAgAAAAEAAQAGAAYAAgAAAAAAAAACAAAAAAAAAAAAAAAAAAUAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0CJoLAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; print DATA "0"; print DATA "true"; print DATA "true"; print DATA "false"; print DATA "false"; print DATA "false"; print DATA "false"; print DATA ""; print DATA "EPSON PM-770C"; print DATA ""; print DATA "true"; print DATA "false"; print DATA "false"; print DATA "true"; print DATA "0"; print DATA "true"; print DATA ""; print DATA "true"; print DATA "false"; print DATA ""; print DATA ""; print DATA ""; } elsif ($type eq "sxc") { print DATA "\n"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "0"; print DATA "0"; print DATA "2258"; print DATA "451"; print DATA ""; print DATA ""; print DATA "View1"; print DATA ""; print DATA ""; print DATA "0"; print DATA "0"; print DATA "0"; print DATA "0"; print DATA "0"; print DATA "0"; print DATA "2"; print DATA "0"; print DATA "0"; print DATA "0"; print DATA "0"; print DATA ""; print DATA ""; print DATA ""; print DATA "Sheet1"; print DATA "270"; print DATA "0"; print DATA "100"; print DATA "60"; print DATA "false"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "12632256"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "false"; print DATA "false"; print DATA "1000"; print DATA "1000"; print DATA "1"; print DATA "1"; print DATA "true"; print DATA ""; print DATA ""; print DATA ""; print DATA ""; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "12632256"; print DATA "true"; print DATA "3"; print DATA "true"; print DATA "true"; print DATA "true"; print DATA "false"; print DATA "false"; print DATA "1000"; print DATA "1000"; print DATA "1"; print DATA "1"; print DATA "true"; print DATA "true"; print DATA "EPSON PM-770C"; print DATA ""; print DATA "fAL+/0VQU09OIFBNLTc3MEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARVBTT04gUE0tNzcwQwAAAAAAAAAAAAAAAAAAAAAAAAAWAAEAwgEAAAAAAAABAAhSAAAEdAAAM1ROVwEACABFUFNPTiBQTS03NzBDAAAAAAAAAAAAAAAAAAAAAAAAAAAEJAKUACYBD4uABwEACQCaCzQIAAABAAcAaAECAAAAaAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAABAAAAIQEAAAAAAAAAAAAARExMTmFtZTE2PUVQSUdVSjNRLkRMTAAAAAAAAAAAAABETExOYW1lMzI9RVBJREEyMzAuRExMAAAAAAAAAAAAAEVQU09OIFBNLTc3MEMAAAAAAAAAAAAAAAAAAAAAAAAAAAMCAGgBaAEBAAAAAAAAAAABAAAJAEwLgQ9MC4EPZABoAWgBoAtxECoAKgAqAMYAoAtxECoAKgAqAMYAAAAAABQAAAAAAAAAAAAyAAAA/wAAAAAAAAAAAAAAAAABAAAAAAACAAAAAgAAAAEAAQAGAAYAAgAAAAAAAAACAAAAAAAAAAAAAAAAAAUAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0CJoLAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; print DATA "true"; print DATA "0"; print DATA "false"; print DATA "false"; print DATA "false"; print DATA ""; print DATA ""; print DATA ""; } close(DATA); } sub oooWriteManifest { # Writes the META-INF/manifest.xml file my($manfile, $builddir, $type); ($builddir, $type) = @_; unless($builddir) {return;} unless (-d "$builddir/META-INF") { mkdir("$builddir/META-INF"); } $manfile = "$builddir/META-INF/manifest.xml"; if ($options{debug}) {print " $manfile\n";} open(DATA, "> $manfile"); print DATA "\n"; # DOCTYPE line print DATA "\n"; # Reading information print DATA "\n"; # Mime type if ($type eq "sxw") { print DATA "\n"; } elsif ($type eq "sxc") { print DATA " \n"; } # For pictures print DATA " \n"; # Contents File print DATA " \n"; # Styles File print DATA " \n"; # Meta File print DATA " \n"; # Settings File print DATA " \n"; # End of file print DATA "\n"; # Forgotten close pointed out by Tom Dierickx # http://www.data-for-all.com/blog/index.php?p=51 close(DATA); } sub oooTimeStamp { # Returns a timestamp of the form yyyy-mm-ddThh:mm:ss my($datestamp); my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time); $datestamp = sprintf("%04d-%02d-%02dT%02d:%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec); return $datestamp; } sub oooDateTime { # Returns the date and time: yyyy, mm, dd, hh, mm, ss my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time); return ($year+1900,$mon+1,$mday,$hour,$min,$sec); } ##################################### # End of the ooolib.pl Perl Library # ##################################### 1; ooolib-perl-0.1.9/examples/0000755000175000017500000000000010561734262015132 5ustar josephjosephooolib-perl-0.1.9/examples/Makefile0000644000175000017500000000210010166314200016546 0ustar josephjoseph# Builds all of the example files all: calc writer zip calc: calc-example1.sxc calc-example2.sxc calc-example3.sxc calc-example4.sxc calc-example5.sxc writer: writer-example1.sxw writer-example2.sxw writer-example3.sxw writer-example4.sxw writer-example5.sxw writer-example6.sxw zip: zip-example1.sxc zip-example2.sxw # Calc Examples calc-example1.sxc: calc-example1 ./calc-example1 calc-example2.sxc: calc-example2 ./calc-example2 calc-example3.sxc: calc-example3 ./calc-example3 calc-example4.sxc: calc-example4 ./calc-example4 calc-example5.sxc: calc-example5 ./calc-example5 # Writer Examples writer-example1.sxw: writer-example1 ./writer-example1 writer-example2.sxw: writer-example2 ./writer-example2 writer-example3.sxw: writer-example3 ./writer-example3 writer-example4.sxw: writer-example4 ./writer-example4 writer-example5.sxw: writer-example5 ./writer-example5 writer-example6.sxw: writer-example6 ./writer-example6 # Zip Examples zip-example1.sxc: zip-example1 ./zip-example1 zip-example2.sxw: zip-example2 ./zip-example2 clean: rm *.sxc *.sxw ooolib-perl-0.1.9/examples/calc-example10000755000175000017500000000233510164642102017465 0ustar josephjoseph#!/usr/bin/perl # calc-example1 - This program creates a SXC Calc file with 25 cells and a formula. use ooolib; # Set variables $doc = new ooolib("sxc"); $doc->oooSet("builddir", "."); # Directory to create document in $doc->oooSet("title", "Calc 25 Cells"); # Title of document $doc->oooSet("subject", "Calc Example"); # Subject of document $doc->oooSet("comments", "Who needs comments?"); # Comments for document $doc->oooSet("keyword", "keyword1"); # Add a keyword for the document $doc->oooSet("keyword", "keyword2"); # Add a keyword for the document $doc->oooSet("author", "ooolib example"); # Set the author of the document # User defined variables $doc->oooSet("meta1-name", "Programmer"); # 1-4 user defined variables $doc->oooSet("meta1-value", "Joseph Colton"); # 1-4 user defined variables # Write the spreadsheet data # It is in x, y cords. for($x=1;$x<=5;$x++) { for($y=1;$y<=5;$y++) { $doc->oooSet("cell-loc", $x, $y); $doc->oooData("cell-float", $x*$y); } } $doc->oooSet("cell-loc", 1 ,6); $doc->oooData("cell-formula", "=SUM(B2:C2)"); $filename = $doc->oooGenerate("calc-example1.sxc"); # Create the document and return a filename exit; ooolib-perl-0.1.9/examples/calc-example20000755000175000017500000000125310164143732017471 0ustar josephjoseph#!/usr/bin/perl # calc-example2 - Set Column sizes use ooolib; # Set variables $doc = new ooolib("sxc"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Calc Column Sizes"); $doc->oooSet("subject", "Calc Example"); $doc->oooSet("comments", "Sizes are set using cm"); $doc->oooSet("author", "ooolib Example"); $doc->oooSet("meta1-name", "Programmer"); $doc->oooSet("meta1-value", "Joseph Colton"); # Write the spreadsheet data my($x, $y); for($x=1;$x<=5;$x++) { $doc->oooSet("column-width", $x, $x); for($y=1;$y<=5;$y++) { $doc->oooSet("cell-loc", $x, $y); $doc->oooData("cell-float", $x*$y); } } my($filename) = $doc->oooGenerate("calc-example2.sxc"); exit; ooolib-perl-0.1.9/examples/calc-example30000755000175000017500000000130310164143567017474 0ustar josephjoseph#!/usr/bin/perl # calc-example3 - This program creates a SXC Calc file and uses auto-inc use ooolib; # Set variables $doc = new ooolib("sxc"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Title - Example 2"); $doc->oooSet("subject", "Subject - Example 2"); $doc->oooSet("comments", "Who needs comments?"); $doc->oooSet("author", "ooolib examples"); $doc->oooSet("cell-auto", 0, 1); $doc->oooSet("meta1-name", "Programmer"); $doc->oooSet("meta1-value", "Joseph Colton"); # Write the spreadsheet data for($x=1;$x<=10;$x++) { $doc->oooData("cell-float", $x); } $doc->oooSet("cell-loc", "C3"); $doc->oooData("cell-float", "123"); my($filename) = $doc->oooGenerate("calc-example3.sxc"); exit; ooolib-perl-0.1.9/examples/calc-example40000755000175000017500000000202510164143711017466 0ustar josephjoseph#!/usr/bin/perl # calc-example4 - This program creates a SXC Calc file by name use ooolib; # Set variables $doc = new ooolib("sxc"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Title - Example 3"); $doc->oooSet("subject", "Subject - Example 3"); $doc->oooSet("comments", "Who needs comments?"); $doc->oooSet("keyword", "keyword1"); $doc->oooSet("keyword", "keyword2"); $doc->oooSet("author", "ooolib examples"); $doc->oooSet("meta1-name", "Programmer"); $doc->oooSet("meta1-value", "Joseph Colton"); # Write the spreadsheet data $doc->oooData("cell-float", 1); $doc->oooSet("cell-down"); $doc->oooData("cell-float", 2); $doc->oooSet("cell-down"); $doc->oooData("cell-float", 3); $doc->oooSet("cell-right"); $doc->oooData("cell-float", 4); $doc->oooSet("cell-right"); $doc->oooData("cell-float", 5); $doc->oooSet("cell-up"); $doc->oooData("cell-float", 6); $doc->oooSet("cell-up"); $doc->oooData("cell-float", 7); $doc->oooSet("cell-left"); $doc->oooData("cell-float", 8); $filename = $doc->oooGenerate("calc-example4.sxc"); exit; ooolib-perl-0.1.9/examples/calc-example50000755000175000017500000000271410164152365017501 0ustar josephjoseph#!/usr/bin/perl # calc-example5 - Set Column sizes use ooolib; # Set variables $doc = new ooolib("sxc"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Calc Cell Styles"); $doc->oooSet("subject", "Calc Example"); $doc->oooSet("comments", "Styles include bold, italics, and colors"); $doc->oooSet("author", "ooolib Example"); $doc->oooSet("meta1-name", "Programmer"); $doc->oooSet("meta1-value", "Joseph Colton"); # Column 1 $doc->oooSet("bold", "on"); $doc->oooSet("cell-loc", 1, 1); $doc->oooData("cell-text", "bold"); $doc->oooSet("text-color", "ff0000"); $doc->oooSet("cell-loc", 1, 2); $doc->oooData("cell-text", "red"); $doc->oooSet("text-color", "00ff00"); $doc->oooSet("cell-loc", 1, 3); $doc->oooData("cell-text", "green"); $doc->oooSet("text-color", "0000ff"); $doc->oooSet("cell-loc", 1, 4); $doc->oooData("cell-text", "blue"); $doc->oooSet("bold", "off"); $doc->oooSet("text-color", "000000"); # Column 2 $doc->oooSet("italic", "on"); $doc->oooSet("cell-loc", 2, 1); $doc->oooData("cell-text", "italic"); $doc->oooSet("text-color", "ff0000"); $doc->oooSet("cell-loc", 2, 2); $doc->oooData("cell-text", "red"); $doc->oooSet("text-color", "00ff00"); $doc->oooSet("cell-loc", 2, 3); $doc->oooData("cell-text", "green"); $doc->oooSet("text-color", "0000ff"); $doc->oooSet("cell-loc", 2, 4); $doc->oooData("cell-text", "blue"); $doc->oooSet("italic", "off"); $doc->oooSet("text-color", "000000"); my($filename) = $doc->oooGenerate("calc-example5.sxc"); exit; ooolib-perl-0.1.9/examples/ooolib.pm0000777000175000017500000000000010561733563021007 2../ooolib.pmustar josephjosephooolib-perl-0.1.9/examples/writer-example10000755000175000017500000000135210164641771020110 0ustar josephjoseph#!/usr/bin/perl # writer-example1 - Creates a sxw Writer document use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "OpenOffice.org Writer Document"); $doc->oooSet("subject", "Writer Examples"); $doc->oooSet("comments", "Simple Writer Document"); $doc->oooSet("author", "ooolib examples"); for($i = 1; $i <= 9; $i++) { $doc->oooData("h${i}", "Heading $i"); } $doc->oooData("textbody", "The lazy fox jumped over the laying log. The log sat under the jumping fox.\nThe lazy fox jumped over the laying log. The log sat under the jumping fox.\nThe lazy fox jumped over the laying log. The log sat under the jumping fox."); $filename = $doc->oooGenerate("writer-example1.sxw"); exit; ooolib-perl-0.1.9/examples/writer-example20000755000175000017500000000120210164643354020102 0ustar josephjoseph#!/usr/bin/perl # writer-example2 - Creates a sxw Writer document use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Another Simple Writer Document"); $doc->oooSet("subject", "Writer Examples"); $doc->oooSet("comments", "Special characters are handled differently"); $doc->oooSet("author", "ooolib example"); $doc->oooData("default", "This is some simple text"); $doc->oooData("default"); # A blank line $doc->oooData("default", "Special Characters: "); $doc->oooData("default", "\t!\"#\$%\&'()`{}[];:+*\\_,.<>?|"); my($filename) = $doc->oooGenerate("writer-example2.sxw"); exit; ooolib-perl-0.1.9/examples/writer-example30000755000175000017500000000367110164642475020122 0ustar josephjoseph#!/usr/bin/perl # writer-example3 - Creates a sxw Writer document use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Writing Styles"); $doc->oooSet("subject", "Writer Example"); $doc->oooSet("comments", "Options can be turned on, then off again."); $doc->oooSet("author", "ooolib examples"); # Left side $doc->oooData("default", "Regular left"); $doc->oooSet("bold", "on"); $doc->oooData("default", "Bold left"); $doc->oooSet("bold", "off"); $doc->oooSet("italic", "on"); $doc->oooData("default", "Italic left"); $doc->oooSet("italic", "off"); $doc->oooSet("underline", "on"); $doc->oooData("default", "Underline left"); $doc->oooSet("underline", "off"); # Center $doc->oooSet("justify", "center"); $doc->oooData("default", "Regular center"); $doc->oooSet("bold", "on"); $doc->oooData("default", "Bold center"); $doc->oooSet("bold", "off"); $doc->oooSet("italic", "on"); $doc->oooData("default", "Italic center"); $doc->oooSet("italic", "off"); $doc->oooSet("underline", "on"); $doc->oooData("default", "Underline center"); $doc->oooSet("underline", "off"); # Right $doc->oooSet("justify", "right"); $doc->oooData("default", "Regular right"); $doc->oooSet("bold", "on"); $doc->oooData("default", "Bold right"); $doc->oooSet("bold", "off"); $doc->oooSet("italic", "on"); $doc->oooData("default", "Italic right"); $doc->oooSet("italic", "off"); $doc->oooSet("underline", "on"); $doc->oooData("default", "Underline right"); $doc->oooSet("underline", "off"); # Block $doc->oooSet("justify", "block"); $doc->oooData("default", "Regular block"); $doc->oooSet("bold", "on"); $doc->oooData("default", "Bold block"); $doc->oooSet("bold", "off"); $doc->oooSet("italic", "on"); $doc->oooData("default", "Italic block"); $doc->oooSet("italic", "off"); $doc->oooSet("underline", "on"); $doc->oooData("default", "Underline block"); $doc->oooSet("underline", "off"); $filename = $doc->oooGenerate("writer-example3.sxw"); exit; ooolib-perl-0.1.9/examples/writer-example40000755000175000017500000000220710164642677020121 0ustar josephjoseph#!/usr/bin/perl # writer-example4 - Creates a sxw Writer document with page breaks and colored text use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Writer Styles"); $doc->oooSet("subject", "Writer Examples"); $doc->oooSet("comments", "Page breaks and colored text."); $doc->oooSet("author", "ooolib examples"); $doc->oooSet("text-color", "blue"); $doc->oooData("default", "blue text"); $doc->oooSet("text-color", "red"); $doc->oooData("default", "red text"); $doc->oooSet("text-color", "green"); $doc->oooData("default", "green text"); $doc->oooSet("text-color", "default"); $doc->oooData("default", "Be prepared for visual pain."); $doc->oooSpecial("pagebreak"); $doc->oooSet("text-bgcolor", "red"); $doc->oooSet("text-color", "blue"); $doc->oooData("default", "blue on red text"); $doc->oooSet("text-bgcolor", "green"); $doc->oooSet("text-color", "red"); $doc->oooData("default", "red on green text"); $doc->oooSet("text-bgcolor", "blue"); $doc->oooSet("text-color", "green"); $doc->oooData("default", "green on blue text"); my($filename) = $doc->oooGenerate("writer-example4.sxw"); exit; ooolib-perl-0.1.9/examples/writer-example50000755000175000017500000000126210164643052020106 0ustar josephjoseph#!/usr/bin/perl # writer-example5 - Creates a sxw Writer document with sizes colors use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Colored Sizes"); $doc->oooSet("subject", "Writer Examples"); $doc->oooSet("comments", "Some fonts cannot be used with some sizes"); $doc->oooSet("author", "ooolib examples"); for($size = 6; $size <= 96; $size+=2) { $red = $size * 2; $blue = 256 - $red; $color = sprintf("%02X99%02X", $red, $blue); $doc->oooSet("text-color", $color); $doc->oooSet("text-size", $size); $doc->oooData("default", "ABC"); } my($filename) = $doc->oooGenerate("writer-example5.sxw"); exit; ooolib-perl-0.1.9/examples/writer-example60000755000175000017500000000163710164643235020120 0ustar josephjoseph#!/usr/bin/perl # writer-example6 - Creates a sxw Writer document with lists use ooolib; # Set variables $doc = new ooolib("sxw"); $doc->oooSet("builddir", "."); $doc->oooSet("title", "Lists and Fonts"); $doc->oooSet("subject", "Writer Examples"); $doc->oooSet("comments", "Now which list was that?"); $doc->oooSet("author", "ooolib examples"); $doc->oooData("h", "Tropical Fruit"); $list = $doc->oooSpecial("list-ordered", "new", "Pineapple"); $doc->oooSpecial("list-ordered", $list, "Papaya"); $doc->oooSpecial("list-ordered", $list, "Banana"); $doc->oooSpecial("list-ordered", $list, "Mango"); $doc->oooSet("text-font", "Bookman"); $doc->oooData("textbody", "Bookman"); $doc->oooSet("text-font", "Courier 10 Pitch"); $doc->oooData("textbody", "Courier 10 Pitch"); $doc->oooSet("text-font", "Zapf Chancery"); $doc->oooData("textbody", "Zapf Chancery"); my($filename) = $doc->oooGenerate("writer-example6.sxw"); exit; ooolib-perl-0.1.9/examples/zip-example10000755000175000017500000000141510166313567017377 0ustar josephjoseph#!/usr/bin/perl # zip-example1 - This program creates a SXC Calc file using the zip command. use ooolib; # Set variables $doc = new ooolib("sxc", "zip"); $doc->oooSet("builddir", "."); # Directory to create document in $doc->oooSet("title", "Zip Command Calc"); # Title of document $doc->oooSet("subject", "Zip Example"); # Subject of document $doc->oooSet("author", "ooolib example"); # Set the author of the document # User defined variables $doc->oooSet("meta1-name", "Programmer"); # 1-4 user defined variables $doc->oooSet("meta1-value", "Joseph Colton"); # 1-4 user defined variables # Document $doc->oooSet("cell-loc", 1, 1); $doc->oooData("cell-text", "zip"); $filename = $doc->oooGenerate("zip-example1.sxc"); exit; ooolib-perl-0.1.9/examples/zip-example20000755000175000017500000000141110166313744017371 0ustar josephjoseph#!/usr/bin/perl # zip-example2 - This program creates a SXW Writer file using the zip command. use ooolib; # Set variables $doc = new ooolib("sxw", "zip"); $doc->oooSet("builddir", "."); # Directory to create document in $doc->oooSet("title", "Zip Command Writer"); # Title of document $doc->oooSet("subject", "Zip Example"); # Subject of document $doc->oooSet("author", "ooolib example"); # Set the author of the document # User defined variables $doc->oooSet("meta1-name", "Programmer"); # 1-4 user defined variables $doc->oooSet("meta1-value", "Joseph Colton"); # 1-4 user defined variables # Document $doc->oooData("textbody", "Created using the zip command."); $filename = $doc->oooGenerate("zip-example2.sxw"); exit; ooolib-perl-0.1.9/ChangeLog0000644000175000017500000000344310561734373015075 0ustar josephjosephVersion 0.1.9 - February 5, 2007 - Updated ooosxcCellLocConv() (Submitted by Nilton Castillo) Version 0.1.8 - December 15, 2006 - Changed License to GNU LGPL from GNU GPL (Joseph Colton) Version 0.1.7 - February 14, 2005 - Uses Archive::Zip as default instead of zip utility - Fixed a bug where META-INF/manifest.xml was not being closed. ( pointed out by Tom Dierickx http://www.data-for-all.com/blog/index.php?p=51 ) Version 0.1.6 - December 29, 2004 - Added bold, italic, and text-color support to Calc Documents - Added a column-width option in cm to Calc Documents - You can now use cell names for spreadsheets (A1, B2) - I lost a lot of code because of a hard drive failure. oops. Version 0.1.5 - March 5, 2004 - Code for formulas (Submitted by Vladimir Vuksan) - Changed to module - Text fonts - Patch 866672 (Submitted by Chris Mayo) - Unicode, Filenames, etc. - Changed oooWrite* function arguments to include type - Fixed bug 811287 (I think) Version 0.1.4 - October 17, 2003 - Page breaks - Text colors and background/highlight colors - Text sizes - Justification for headers - Ordered Lists Version 0.1.3 - October 9, 2003 - Redesigned Library API - Cell-auto increment feature - Handles special characters better - Bold, Italics, Underline Added - Left, Center, Right, and Block justification Version 0.1.2 - August 17, 2003 - Added sxw functions for text and headings. - Combined ooosxc and ooosxw functions. - Bug Fixes Version 0.1.1 - August 15, 2003 - Removed skel directory, now creating from scratch. - Added ooosxcWriteManifest dummy function. - Added ooosxcWriteSettings dummy function. - Added ooosxcWriteStyles dummy function. - Added ooosxcWriteMimetype dummy function. Version 0.1.0 - August 8, 2003 - Added support for creating sxc files. ooolib-perl-0.1.9/mime.types0000644000175000017500000000013010135536463015323 0ustar josephjosephapplication/vnd.sun.xml.calc sxc application/vnd.sun.xml.writer sxw