1cdf0e10cSrcweir:
2cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}'
3cdf0e10cSrcweir    if 0;
4*bb113e63SAndrew Rist# *************************************************************
5*bb113e63SAndrew Rist#
6*bb113e63SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
7*bb113e63SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
8*bb113e63SAndrew Rist#  distributed with this work for additional information
9*bb113e63SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
10*bb113e63SAndrew Rist#  to you under the Apache License, Version 2.0 (the
11*bb113e63SAndrew Rist#  "License"); you may not use this file except in compliance
12*bb113e63SAndrew Rist#  with the License.  You may obtain a copy of the License at
13*bb113e63SAndrew Rist#
14*bb113e63SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
15*bb113e63SAndrew Rist#
16*bb113e63SAndrew Rist#  Unless required by applicable law or agreed to in writing,
17*bb113e63SAndrew Rist#  software distributed under the License is distributed on an
18*bb113e63SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19*bb113e63SAndrew Rist#  KIND, either express or implied.  See the License for the
20*bb113e63SAndrew Rist#  specific language governing permissions and limitations
21*bb113e63SAndrew Rist#  under the License.
22*bb113e63SAndrew Rist#
23*bb113e63SAndrew Rist# *************************************************************
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse	IO::File;
27cdf0e10cSrcweiruse	Cwd;
28cdf0e10cSrcweiruse File::Spec;
29cdf0e10cSrcweiruse File::Spec::Functions;
30cdf0e10cSrcweiruse File::Temp;
31cdf0e10cSrcweiruse File::Path;
32cdf0e10cSrcweir
33cdf0e10cSrcweir$TempDir = "";
34cdf0e10cSrcweir
35cdf0e10cSrcweir
36cdf0e10cSrcweir# all the XML package generation is a blatant rip from AF's
37cdf0e10cSrcweir# write-calc-doc.pl
38cdf0e10cSrcweir
39cdf0e10cSrcweir
40cdf0e10cSrcweir###############################################################################
41cdf0e10cSrcweir#	Open a file with the given name.
42cdf0e10cSrcweir#	First it is checked if the temporary directory, in which all files for
43cdf0e10cSrcweir#	the document are gathered, is already present and create it if it is not.
44cdf0e10cSrcweir#	Then create the path to the file inside the temporary directory.
45cdf0e10cSrcweir#	Finally open the file and return a file handle to it.
46cdf0e10cSrcweir#
47cdf0e10cSrcweirsub	open_file
48cdf0e10cSrcweir{
49cdf0e10cSrcweir	my	$filename = pop @_;
50cdf0e10cSrcweir
51cdf0e10cSrcweir	#	Create base directory of temporary directory tree if not alreay
52cdf0e10cSrcweir	#	present.
53cdf0e10cSrcweir	if ($TempDir eq "")
54cdf0e10cSrcweir	{
55cdf0e10cSrcweir		$TempDir = File::Temp::tempdir (CLEANUP => 1);
56cdf0e10cSrcweir	}
57cdf0e10cSrcweir
58cdf0e10cSrcweir	#	Create the path to the file.
59cdf0e10cSrcweir	my $fullname = File::Spec->catfile ($TempDir, $filename);
60cdf0e10cSrcweir	my ($volume,$directories,$file) = File::Spec->splitpath ($fullname);
61cdf0e10cSrcweir	mkpath (File::Spec->catpath ($volume,$directories,""));
62cdf0e10cSrcweir
63cdf0e10cSrcweir	#	Open the file and return a file handle to it.
64cdf0e10cSrcweir	return new IO::File ($fullname, "w");
65cdf0e10cSrcweir}
66cdf0e10cSrcweir
67cdf0e10cSrcweir
68cdf0e10cSrcweir###############################################################################
69cdf0e10cSrcweir#	Zip the files in the directory tree into the given file.
70cdf0e10cSrcweir#
71cdf0e10cSrcweirsub	zip_dirtree
72cdf0e10cSrcweir{
73cdf0e10cSrcweir	my	$filename = pop @_;
74cdf0e10cSrcweir
75cdf0e10cSrcweir	my	$cwd = getcwd;
76cdf0e10cSrcweir	my	$zip_name = $filename;
77cdf0e10cSrcweir
78cdf0e10cSrcweir	#	We are about to change the directory.
79cdf0e10cSrcweir	#	Therefore create an absolute pathname for the zip archive.
80cdf0e10cSrcweir
81cdf0e10cSrcweir	#	First transfer the drive from $cwd to $zip_name.  This is a
82cdf0e10cSrcweir	#	workaround for a bug in file_name_is_absolute which thinks
83cdf0e10cSrcweir	#	the the path \bla is an absolute path under DOS.
84cdf0e10cSrcweir	my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name);
85cdf0e10cSrcweir	my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd);
86cdf0e10cSrcweir	$volume = $volume_cwd if ($volume eq "");
87cdf0e10cSrcweir	$zip_name = File::Spec->catpath ($volume,$directories,$file);
88cdf0e10cSrcweir
89cdf0e10cSrcweir	#	Add the current working directory to a relative path.
90cdf0e10cSrcweir	if ( ! file_name_is_absolute ($zip_name))
91cdf0e10cSrcweir	{
92cdf0e10cSrcweir		$zip_name = File::Spec->catfile ($cwd, $zip_name);
93cdf0e10cSrcweir
94cdf0e10cSrcweir		#	Try everything to clean up the name.
95cdf0e10cSrcweir		$zip_name = File::Spec->rel2abs ($filename);
96cdf0e10cSrcweir		$zip_name = File::Spec->canonpath ($zip_name);
97cdf0e10cSrcweir
98cdf0e10cSrcweir		#	Remove .. directories from the middle of the path.
99cdf0e10cSrcweir		while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//)
100cdf0e10cSrcweir		{
101cdf0e10cSrcweir			$zip_name = $` . "/" . $';
102cdf0e10cSrcweir		}
103cdf0e10cSrcweir	}
104cdf0e10cSrcweir
105cdf0e10cSrcweir	#	Just in case the zip program gets confused by an existing file with the
106cdf0e10cSrcweir	#	same name as the one to be written that file is removed first.
107cdf0e10cSrcweir	if ( -e $filename)
108cdf0e10cSrcweir	{
109cdf0e10cSrcweir		if (unlink ($filename) == 0)
110cdf0e10cSrcweir		{
111cdf0e10cSrcweir			print "Existing file $filename could not be deleted.\n";
112cdf0e10cSrcweir			print "Please close the application that uses it, then try again.\n";
113cdf0e10cSrcweir			return;
114cdf0e10cSrcweir		}
115cdf0e10cSrcweir	}
116cdf0e10cSrcweir
117cdf0e10cSrcweir	#	Finally create the zip file.  First change into the temporary directory
118cdf0e10cSrcweir	#	so that the resulting zip file contains only paths relative to it.
119cdf0e10cSrcweir	print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
120cdf0e10cSrcweir	chdir ($TempDir);
121cdf0e10cSrcweir	system ("$ZipCmd $ZipFlags $zip_name *");
122cdf0e10cSrcweir	chdir ($cwd);
123cdf0e10cSrcweir
124cdf0e10cSrcweir}
125cdf0e10cSrcweir
126cdf0e10cSrcweir
127cdf0e10cSrcweirsub writeHeader
128cdf0e10cSrcweir{
129cdf0e10cSrcweir	print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
130cdf0e10cSrcweir
131cdf0e10cSrcweir<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
132cdf0e10cSrcweir <office:scripts/>
133cdf0e10cSrcweir <office:automatic-styles>
134cdf0e10cSrcweir~;
135cdf0e10cSrcweir
136cdf0e10cSrcweir}
137cdf0e10cSrcweir
138cdf0e10cSrcweirsub writeSlideStyles
139cdf0e10cSrcweir{
140cdf0e10cSrcweir	my $mode = pop @_;
141cdf0e10cSrcweir	my $direction = pop @_;
142cdf0e10cSrcweir	my $transitionSubType = pop @_;
143cdf0e10cSrcweir	my $transitionType = pop @_;
144cdf0e10cSrcweir	my $slideNum = pop @_;
145cdf0e10cSrcweir
146cdf0e10cSrcweir	print $OUT "  <style:style style:name=\"dp",$slideNum,"\" style:family=\"drawing-page\">\n";
147cdf0e10cSrcweir	print $OUT "   <style:drawing-page-properties presentation:transition-type=\"automatic\" presentation:duration=\"PT00H00M01S\" presentation:background-visible=\"true\" presentation:background-objects-visible=\"true\" draw:fill=\"solid\" draw:fill-color=\"#ff",$slideNum % 2 ? "ff99" : "cc99","\" smil:type=\"",$transitionType,"\" smil:subtype=\"",$transitionSubType,"\" ",$direction == 0 ? "" : "smil:direction=\"reverse\" ",$mode == 0 ? "" : "smil:mode=\"out\"","/>\n";
148cdf0e10cSrcweir	print $OUT "  </style:style>\n";
149cdf0e10cSrcweir}
150cdf0e10cSrcweir
151cdf0e10cSrcweirsub writeIntermediate
152cdf0e10cSrcweir{
153cdf0e10cSrcweir	print $OUT qq~  <style:style style:name="gr1" style:family="graphic">
154cdf0e10cSrcweir   <style:graphic-properties style:protect="size"/>
155cdf0e10cSrcweir  </style:style>
156cdf0e10cSrcweir  <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
157cdf0e10cSrcweir   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
158cdf0e10cSrcweir  </style:style>
159cdf0e10cSrcweir  <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
160cdf0e10cSrcweir   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
161cdf0e10cSrcweir  </style:style>
162cdf0e10cSrcweir  <style:style style:name="P1" style:family="paragraph">
163cdf0e10cSrcweir   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
164cdf0e10cSrcweir  </style:style>
165cdf0e10cSrcweir  <style:style style:name="P2" style:family="paragraph">
166cdf0e10cSrcweir   <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
167cdf0e10cSrcweir  </style:style>
168cdf0e10cSrcweir  <text:list-style style:name="L1">
169cdf0e10cSrcweir   <text:list-level-style-bullet text:level="1" text:bullet-char="●">
170cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
171cdf0e10cSrcweir   </text:list-level-style-bullet>
172cdf0e10cSrcweir   <text:list-level-style-bullet text:level="2" text:bullet-char="●">
173cdf0e10cSrcweir    <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
174cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
175cdf0e10cSrcweir   </text:list-level-style-bullet>
176cdf0e10cSrcweir   <text:list-level-style-bullet text:level="3" text:bullet-char="●">
177cdf0e10cSrcweir    <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
178cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
179cdf0e10cSrcweir   </text:list-level-style-bullet>
180cdf0e10cSrcweir   <text:list-level-style-bullet text:level="4" text:bullet-char="●">
181cdf0e10cSrcweir    <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
182cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
183cdf0e10cSrcweir   </text:list-level-style-bullet>
184cdf0e10cSrcweir   <text:list-level-style-bullet text:level="5" text:bullet-char="●">
185cdf0e10cSrcweir    <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
186cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
187cdf0e10cSrcweir   </text:list-level-style-bullet>
188cdf0e10cSrcweir   <text:list-level-style-bullet text:level="6" text:bullet-char="●">
189cdf0e10cSrcweir    <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
190cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
191cdf0e10cSrcweir   </text:list-level-style-bullet>
192cdf0e10cSrcweir   <text:list-level-style-bullet text:level="7" text:bullet-char="●">
193cdf0e10cSrcweir    <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
194cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
195cdf0e10cSrcweir   </text:list-level-style-bullet>
196cdf0e10cSrcweir   <text:list-level-style-bullet text:level="8" text:bullet-char="●">
197cdf0e10cSrcweir    <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
198cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
199cdf0e10cSrcweir   </text:list-level-style-bullet>
200cdf0e10cSrcweir   <text:list-level-style-bullet text:level="9" text:bullet-char="●">
201cdf0e10cSrcweir    <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
202cdf0e10cSrcweir    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
203cdf0e10cSrcweir   </text:list-level-style-bullet>
204cdf0e10cSrcweir  </text:list-style>
205cdf0e10cSrcweir </office:automatic-styles>
206cdf0e10cSrcweir <office:body>
207cdf0e10cSrcweir  <office:presentation>
208cdf0e10cSrcweir~;
209cdf0e10cSrcweir
210cdf0e10cSrcweir}
211cdf0e10cSrcweir
212cdf0e10cSrcweirsub writeSlide
213cdf0e10cSrcweir{
214cdf0e10cSrcweir	my $mode = pop @_;
215cdf0e10cSrcweir	my $direction = pop @_;
216cdf0e10cSrcweir	my $transitionSubtype = pop @_;
217cdf0e10cSrcweir	my $transitionType = pop @_;
218cdf0e10cSrcweir	my $slideNum = pop @_;
219cdf0e10cSrcweir
220cdf0e10cSrcweir	print $OUT "   <draw:page draw:name=\"page",$slideNum,"\" draw:style-name=\"dp",$slideNum,"\" draw:master-page-name=\"Default\" presentation:presentation-page-layout-name=\"AL1T19\">";
221cdf0e10cSrcweir
222cdf0e10cSrcweir	print $OUT "    <draw:frame presentation:style-name=\"pr1\" draw:layer=\"layout\" svg:width=\"25.199cm\" svg:height=\"3.256cm\" svg:x=\"1.4cm\" svg:y=\"0.962cm\" presentation:class=\"title\">\n";
223cdf0e10cSrcweir	print $OUT "     <draw:text-box>\n";
224cdf0e10cSrcweir	print $OUT "      <text:p text:style-name=\"P1\">Transition “",$slideNum-1,"”</text:p>\n";
225cdf0e10cSrcweir	print $OUT "     </draw:text-box>\n";
226cdf0e10cSrcweir	print $OUT "    </draw:frame>\n";
227cdf0e10cSrcweir	print $OUT "    <draw:frame presentation:style-name=\"pr2\" draw:layer=\"layout\" svg:width=\"25.199cm\" svg:height=\"13.609cm\" svg:x=\"1.4cm\" svg:y=\"4.914cm\" presentation:class=\"outline\">\n";
228cdf0e10cSrcweir	print $OUT "     <draw:text-box>\n";
229cdf0e10cSrcweir	print $OUT "      <text:list text:style-name=\"L2\">\n";
230cdf0e10cSrcweir	print $OUT "       <text:list-item>\n";
231cdf0e10cSrcweir	print $OUT "        <text:p text:style-name=\"P2\">Transition: ",$transitionType,"</text:p>\n";
232cdf0e10cSrcweir	print $OUT "       </text:list-item>\n";
233cdf0e10cSrcweir	print $OUT "      </text:list>\n";
234cdf0e10cSrcweir	print $OUT "      <text:list text:style-name=\"L2\">\n";
235cdf0e10cSrcweir	print $OUT "       <text:list-item>\n";
236cdf0e10cSrcweir	print $OUT "        <text:list>\n";
237cdf0e10cSrcweir	print $OUT "         <text:list-item>\n";
238cdf0e10cSrcweir	print $OUT "          <text:p text:style-name=\"P3\">Subtype: ",$transitionSubtype,"</text:p>\n";
239cdf0e10cSrcweir	print $OUT "         </text:list-item>\n";
240cdf0e10cSrcweir	print $OUT "        </text:list>\n";
241cdf0e10cSrcweir	print $OUT "       </text:list-item>\n";
242cdf0e10cSrcweir	print $OUT "      </text:list>\n";
243cdf0e10cSrcweir	print $OUT "      <text:list text:style-name=\"L2\">\n";
244cdf0e10cSrcweir	print $OUT "       <text:list-item>\n";
245cdf0e10cSrcweir	print $OUT "        <text:list>\n";
246cdf0e10cSrcweir	print $OUT "         <text:list-item>\n";
247cdf0e10cSrcweir	print $OUT "          <text:p text:style-name=\"P3\">Direction: ",$direction == 0 ? "forward" : "reverse","</text:p>\n";
248cdf0e10cSrcweir	print $OUT "         </text:list-item>\n";
249cdf0e10cSrcweir	print $OUT "        </text:list>\n";
250cdf0e10cSrcweir	print $OUT "       </text:list-item>\n";
251cdf0e10cSrcweir	print $OUT "      </text:list>\n";
252cdf0e10cSrcweir	print $OUT "      <text:list text:style-name=\"L2\">\n";
253cdf0e10cSrcweir	print $OUT "       <text:list-item>\n";
254cdf0e10cSrcweir	print $OUT "        <text:list>\n";
255cdf0e10cSrcweir	print $OUT "         <text:list-item>\n";
256cdf0e10cSrcweir	print $OUT "          <text:p text:style-name=\"P3\">Mode: ",$mode == 0 ? "in" : "out","</text:p>\n";
257cdf0e10cSrcweir	print $OUT "         </text:list-item>\n";
258cdf0e10cSrcweir	print $OUT "        </text:list>\n";
259cdf0e10cSrcweir	print $OUT "       </text:list-item>\n";
260cdf0e10cSrcweir	print $OUT "      </text:list>\n";
261cdf0e10cSrcweir	print $OUT "     </draw:text-box>\n";
262cdf0e10cSrcweir	print $OUT "    </draw:frame>\n";
263cdf0e10cSrcweir	print $OUT "    <presentation:notes draw:style-name=\"dp2\">\n";
264cdf0e10cSrcweir	print $OUT "     <draw:page-thumbnail draw:style-name=\"gr1\" draw:layer=\"layout\" svg:width=\"14.851cm\" svg:height=\"11.138cm\" svg:x=\"3.068cm\" svg:y=\"2.257cm\" draw:page-number=\"1\" presentation:class=\"page\"/>\n";
265cdf0e10cSrcweir	print $OUT "     <draw:frame presentation:style-name=\"pr3\" draw:layer=\"layout\" svg:width=\"16.79cm\" svg:height=\"13.116cm\" svg:x=\"2.098cm\" svg:y=\"14.109cm\" presentation:class=\"notes\" presentation:placeholder=\"true\">\n";
266cdf0e10cSrcweir	print $OUT "      <draw:text-box/>\n";
267cdf0e10cSrcweir	print $OUT "     </draw:frame>\n";
268cdf0e10cSrcweir	print $OUT "    </presentation:notes>\n";
269cdf0e10cSrcweir	print $OUT "   </draw:page>\n";
270cdf0e10cSrcweir
271cdf0e10cSrcweir}
272cdf0e10cSrcweir
273cdf0e10cSrcweirsub writeFooter
274cdf0e10cSrcweir{
275cdf0e10cSrcweir	print $OUT qq~   <presentation:settings presentation:full-screen="false"/>
276cdf0e10cSrcweir  </office:presentation>
277cdf0e10cSrcweir </office:body>
278cdf0e10cSrcweir</office:document-content>
279cdf0e10cSrcweir~;
280cdf0e10cSrcweir
281cdf0e10cSrcweir}
282cdf0e10cSrcweir
283cdf0e10cSrcweirsub writeManifest
284cdf0e10cSrcweir{
285cdf0e10cSrcweir	my $outFile = open_file("META-INF/manifest.xml");
286cdf0e10cSrcweir
287cdf0e10cSrcweir	print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
288cdf0e10cSrcweir<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
289cdf0e10cSrcweir<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
290cdf0e10cSrcweir <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
291cdf0e10cSrcweir <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
292cdf0e10cSrcweir</manifest:manifest>
293cdf0e10cSrcweir~;
294cdf0e10cSrcweir
295cdf0e10cSrcweir	$outFile->close;
296cdf0e10cSrcweir}
297cdf0e10cSrcweir
298cdf0e10cSrcweir
299cdf0e10cSrcweir$transitionsRef = [
300cdf0e10cSrcweir
301cdf0e10cSrcweir				["barWipe",
302cdf0e10cSrcweir				 ["leftToRight",
303cdf0e10cSrcweir				  "topToBottom"]],
304cdf0e10cSrcweir
305cdf0e10cSrcweir				["blindsWipe",
306cdf0e10cSrcweir				 ["vertical",
307cdf0e10cSrcweir				  "horizontal"]],
308cdf0e10cSrcweir
309cdf0e10cSrcweir				["boxWipe",
310cdf0e10cSrcweir				 ["topLeft",
311cdf0e10cSrcweir				  "topRight",
312cdf0e10cSrcweir				  "bottomRight",
313cdf0e10cSrcweir				  "bottomLeft",
314cdf0e10cSrcweir				  "topCenter",
315cdf0e10cSrcweir				  "rightCenter",
316cdf0e10cSrcweir				  "bottomCenter",
317cdf0e10cSrcweir				  "leftCenter"]],
318cdf0e10cSrcweir
319cdf0e10cSrcweir				["fourBoxWipe",
320cdf0e10cSrcweir				 ["cornersIn",
321cdf0e10cSrcweir				  "cornersOut"]],
322cdf0e10cSrcweir
323cdf0e10cSrcweir				["barnDoorWipe",
324cdf0e10cSrcweir				 ["vertical",
325cdf0e10cSrcweir				  "horizontal",
326cdf0e10cSrcweir				  "diagonalBottomLeft",
327cdf0e10cSrcweir				  "diagonalTopLeft"]],
328cdf0e10cSrcweir
329cdf0e10cSrcweir				["bowTieWipe",
330cdf0e10cSrcweir				 ["vertical",
331cdf0e10cSrcweir				  "horizontal"]],
332cdf0e10cSrcweir
333cdf0e10cSrcweir				["miscDiagonalWipe",
334cdf0e10cSrcweir				 ["doubleBarnDoor",
335cdf0e10cSrcweir				  "doubleDiamond"]],
336cdf0e10cSrcweir
337cdf0e10cSrcweir				["veeWipe",
338cdf0e10cSrcweir				 ["down",
339cdf0e10cSrcweir				  "left",
340cdf0e10cSrcweir				  "up",
341cdf0e10cSrcweir				  "right"]],
342cdf0e10cSrcweir
343cdf0e10cSrcweir				["barnVeeWipe",
344cdf0e10cSrcweir				 ["top",
345cdf0e10cSrcweir				  "left",
346cdf0e10cSrcweir				  "up",
347cdf0e10cSrcweir				  "right"]],
348cdf0e10cSrcweir
349cdf0e10cSrcweir				["zigZagWipe",
350cdf0e10cSrcweir				 ["leftToRight",
351cdf0e10cSrcweir				  "topToBottom"]],
352cdf0e10cSrcweir
353cdf0e10cSrcweir				["barnZigZagWipe",
354cdf0e10cSrcweir				 ["vertical",
355cdf0e10cSrcweir				  "horizontal"]],
356cdf0e10cSrcweir
357cdf0e10cSrcweir				["irisWipe",
358cdf0e10cSrcweir				 ["rectangle",
359cdf0e10cSrcweir				  "diamond"]],
360cdf0e10cSrcweir
361cdf0e10cSrcweir				["triangleWipe",
362cdf0e10cSrcweir				 ["up",
363cdf0e10cSrcweir				  "right",
364cdf0e10cSrcweir				  "down",
365cdf0e10cSrcweir				  "left"]],
366cdf0e10cSrcweir
367cdf0e10cSrcweir				["arrowHeadWipe",
368cdf0e10cSrcweir				 ["up",
369cdf0e10cSrcweir				  "right",
370cdf0e10cSrcweir				  "down",
371cdf0e10cSrcweir				  "left"]],
372cdf0e10cSrcweir
373cdf0e10cSrcweir				["pentagonWipe",
374cdf0e10cSrcweir				 ["up",
375cdf0e10cSrcweir				  "down"]],
376cdf0e10cSrcweir
377cdf0e10cSrcweir				["hexagonWipe",
378cdf0e10cSrcweir				 ["horizontal",
379cdf0e10cSrcweir				  "vertical"]],
380cdf0e10cSrcweir
381cdf0e10cSrcweir				["ellipseWipe",
382cdf0e10cSrcweir				 ["circle",
383cdf0e10cSrcweir				  "horizontal",
384cdf0e10cSrcweir				  "vertical"]],
385cdf0e10cSrcweir
386cdf0e10cSrcweir				["eyeWipe",
387cdf0e10cSrcweir				 ["vertical",
388cdf0e10cSrcweir				  "horizontal"]],
389cdf0e10cSrcweir
390cdf0e10cSrcweir				["roundRectWipe",
391cdf0e10cSrcweir				 ["horizontal",
392cdf0e10cSrcweir				  "vertical"]],
393cdf0e10cSrcweir
394cdf0e10cSrcweir				["starWipe",
395cdf0e10cSrcweir				 ["fourPoint",
396cdf0e10cSrcweir				  "fivePoint",
397cdf0e10cSrcweir				  "sixPoint"]],
398cdf0e10cSrcweir
399cdf0e10cSrcweir				["miscShapeWipe",
400cdf0e10cSrcweir				 ["heart",
401cdf0e10cSrcweir				  "keyhole"]],
402cdf0e10cSrcweir
403cdf0e10cSrcweir				["clockWipe",
404cdf0e10cSrcweir				 ["clockwiseTwelve",
405cdf0e10cSrcweir				  "clockwiseThree",
406cdf0e10cSrcweir				  "clockwiseSix",
407cdf0e10cSrcweir				  "clockwiseNine"]],
408cdf0e10cSrcweir
409cdf0e10cSrcweir				["pinWheelWipe",
410cdf0e10cSrcweir				 ["oneBlade",
411cdf0e10cSrcweir				  "twoBladeVertical",
412cdf0e10cSrcweir				  "twoBladeHorizontal",
413cdf0e10cSrcweir				  "threeBlade",
414cdf0e10cSrcweir				  "fourBlade",
415cdf0e10cSrcweir				  "eightBlade"]],
416cdf0e10cSrcweir
417cdf0e10cSrcweir				["singleSweepWipe",
418cdf0e10cSrcweir				 ["clockwiseTop",
419cdf0e10cSrcweir				  "clockwiseRight",
420cdf0e10cSrcweir				  "clockwiseBottom",
421cdf0e10cSrcweir				  "clockwiseLeft",
422cdf0e10cSrcweir				  "clockwiseTopLeft",
423cdf0e10cSrcweir				  "counterClockwiseBottomLeft",
424cdf0e10cSrcweir				  "clockwiseBottomRight",
425cdf0e10cSrcweir				  "counterClockwiseTopRight"]],
426cdf0e10cSrcweir
427cdf0e10cSrcweir				["fanWipe",
428cdf0e10cSrcweir				 ["centerTop",
429cdf0e10cSrcweir				  "centerRight",
430cdf0e10cSrcweir				  "top",
431cdf0e10cSrcweir				  "right",
432cdf0e10cSrcweir				  "bottom",
433cdf0e10cSrcweir				  "left"]],
434cdf0e10cSrcweir
435cdf0e10cSrcweir				["doubleFanWipe",
436cdf0e10cSrcweir				 ["fanOutVertical",
437cdf0e10cSrcweir				  "fanOutHorizontal",
438cdf0e10cSrcweir				  "fanInVertical",
439cdf0e10cSrcweir				  "fanInHorizontal"]],
440cdf0e10cSrcweir
441cdf0e10cSrcweir				["doubleSweepWipe",
442cdf0e10cSrcweir				 ["parallelVertical",
443cdf0e10cSrcweir				  "parallelDiagonal",
444cdf0e10cSrcweir				  "oppositeVertical",
445cdf0e10cSrcweir				  "oppositeHorizontal",
446cdf0e10cSrcweir				  "parallelDiagonalTopLeft",
447cdf0e10cSrcweir				  "parallelDiagonalBottomLeft"]],
448cdf0e10cSrcweir
449cdf0e10cSrcweir				["saloonDoorWipe",
450cdf0e10cSrcweir				 ["top",
451cdf0e10cSrcweir				  "left",
452cdf0e10cSrcweir				  "bottom",
453cdf0e10cSrcweir				  "right"]],
454cdf0e10cSrcweir
455cdf0e10cSrcweir				["windshieldWipe",
456cdf0e10cSrcweir				 ["right",
457cdf0e10cSrcweir				  "up",
458cdf0e10cSrcweir				  "vertical",
459cdf0e10cSrcweir				  "horizontal"]],
460cdf0e10cSrcweir
461cdf0e10cSrcweir				["snakeWipe",
462cdf0e10cSrcweir				 ["topLeftHorizontal",
463cdf0e10cSrcweir				  "topLeftVertical",
464cdf0e10cSrcweir				  "topLeftDiagonal",
465cdf0e10cSrcweir				  "topRightDiagonal",
466cdf0e10cSrcweir				  "bottomRightDiagonal",
467cdf0e10cSrcweir				  "bottomLeftDiagonal"]],
468cdf0e10cSrcweir
469cdf0e10cSrcweir				["spiralWipe",
470cdf0e10cSrcweir				 ["topLeftClockwise",
471cdf0e10cSrcweir				  "topRightClockwise",
472cdf0e10cSrcweir				  "bottomRightClockwise",
473cdf0e10cSrcweir				  "bottomLeftClockwise",
474cdf0e10cSrcweir				  "topLeftCounterClockwise",
475cdf0e10cSrcweir				  "topRightCounterClockwise",
476cdf0e10cSrcweir				  "bottomRightCounterClockwise",
477cdf0e10cSrcweir				  "bottomLeftCounterClockwise"]],
478cdf0e10cSrcweir
479cdf0e10cSrcweir				["parallelSnakesWipe",
480cdf0e10cSrcweir				 ["verticalTopSame",
481cdf0e10cSrcweir				  "verticalBottomSame",
482cdf0e10cSrcweir				  "verticalTopLeftOpposite",
483cdf0e10cSrcweir				  "verticalBottomLeftOpposite",
484cdf0e10cSrcweir				  "horizontalLeftSame",
485cdf0e10cSrcweir				  "horizontalRightSame",
486cdf0e10cSrcweir				  "horizontalTopLeftOpposite",
487cdf0e10cSrcweir				  "horizontalTopRightOpposite",
488cdf0e10cSrcweir				  "diagonalBottomLeftOpposite",
489cdf0e10cSrcweir				  "diagonalTopLeftOpposite"]],
490cdf0e10cSrcweir
491cdf0e10cSrcweir				["boxSnakesWipe",
492cdf0e10cSrcweir				 ["twoBoxTop",
493cdf0e10cSrcweir				  "twoBoxLeft",
494cdf0e10cSrcweir				  "twoBoxRight",
495cdf0e10cSrcweir				  "fourBoxVertical",
496cdf0e10cSrcweir				  "fourBoxHorizontal"]],
497cdf0e10cSrcweir
498cdf0e10cSrcweir				["waterfallWipe",
499cdf0e10cSrcweir				 ["verticalLeft",
500cdf0e10cSrcweir				  "verticalRight",
501cdf0e10cSrcweir				  "horizontalLeft",
502cdf0e10cSrcweir				  "horizontalRight"]],
503cdf0e10cSrcweir
504cdf0e10cSrcweir				["pushWipe",
505cdf0e10cSrcweir				 ["fromLeft",
506cdf0e10cSrcweir				  "fromTop",
507cdf0e10cSrcweir				  "fromRight",
508cdf0e10cSrcweir				  "fromBottom",
509cdf0e10cSrcweir				  "fromBottomRight",
510cdf0e10cSrcweir				  "fromBottomLeft",
511cdf0e10cSrcweir				  "fromTopRight",
512cdf0e10cSrcweir				  "fromTopLeft",
513cdf0e10cSrcweir				  "combHorizontal",
514cdf0e10cSrcweir				  "combVertical"]],
515cdf0e10cSrcweir
516cdf0e10cSrcweir				["slideWipe",
517cdf0e10cSrcweir				 ["fromLeft",
518cdf0e10cSrcweir				  "fromTop",
519cdf0e10cSrcweir				  "fromRight",
520cdf0e10cSrcweir				  "fromBottom",
521cdf0e10cSrcweir				  "fromBottomRight",
522cdf0e10cSrcweir				  "fromBottomLeft",
523cdf0e10cSrcweir				  "fromTopRight",
524cdf0e10cSrcweir				  "fromTopLeft"]],
525cdf0e10cSrcweir
526cdf0e10cSrcweir				["fade",
527cdf0e10cSrcweir				 ["crossfade",
528cdf0e10cSrcweir				  "fadeToColor",
529cdf0e10cSrcweir				  "fadeFromColor",
530cdf0e10cSrcweir				  "fadeOverColor"]],
531cdf0e10cSrcweir
532cdf0e10cSrcweir				["randomBarWipe",
533cdf0e10cSrcweir				 ["vertical",
534cdf0e10cSrcweir				  "horizontal"]],
535cdf0e10cSrcweir
536cdf0e10cSrcweir				["checkerBoardWipe",
537cdf0e10cSrcweir				 ["down",
538cdf0e10cSrcweir				  "across"]],
539cdf0e10cSrcweir
540cdf0e10cSrcweir				["dissolve",
541cdf0e10cSrcweir				 ["default"]]
542cdf0e10cSrcweir];
543cdf0e10cSrcweir
544cdf0e10cSrcweir
545cdf0e10cSrcweir###############################################################################
546cdf0e10cSrcweir#	Print usage information.
547cdf0e10cSrcweir#
548cdf0e10cSrcweirsub	usage	()
549cdf0e10cSrcweir{
550cdf0e10cSrcweir	print <<END_OF_USAGE;
551cdf0e10cSrcweirusage: $0 <option>* [<output-file-name>]
552cdf0e10cSrcweir
553cdf0e10cSrcweiroutput-file-name defaults to alltransitions.odp.
554cdf0e10cSrcweir
555cdf0e10cSrcweiroptions: -a    Generate _all_ combinations of type, subtype,
556cdf0e10cSrcweir               direction, and mode
557cdf0e10cSrcweir         -h    Print this usage information.
558cdf0e10cSrcweirEND_OF_USAGE
559cdf0e10cSrcweir}
560cdf0e10cSrcweir
561cdf0e10cSrcweir###############################################################################
562cdf0e10cSrcweir#	Process the command line.
563cdf0e10cSrcweir#
564cdf0e10cSrcweirsub	process_command_line
565cdf0e10cSrcweir{
566cdf0e10cSrcweir	foreach (@ARGV)
567cdf0e10cSrcweir	{
568cdf0e10cSrcweir		if (/^-h/)
569cdf0e10cSrcweir		{
570cdf0e10cSrcweir			usage;
571cdf0e10cSrcweir			exit 0;
572cdf0e10cSrcweir		}
573cdf0e10cSrcweir	}
574cdf0e10cSrcweir
575cdf0e10cSrcweir	$global_gen_all=0;
576cdf0e10cSrcweir	$global_output_name = "alltransitions.odp";
577cdf0e10cSrcweir
578cdf0e10cSrcweir	my	$j = 0;
579cdf0e10cSrcweir	for (my $i=0; $i<=$#ARGV; $i++)
580cdf0e10cSrcweir	{
581cdf0e10cSrcweir		if ($ARGV[$i] eq "-a")
582cdf0e10cSrcweir		{
583cdf0e10cSrcweir			$global_gen_all=1;
584cdf0e10cSrcweir		}
585cdf0e10cSrcweir		elsif ($ARGV[$i] =~ /^-/)
586cdf0e10cSrcweir		{
587cdf0e10cSrcweir		    print "Unknown option $ARGV[$i]\n";
588cdf0e10cSrcweir			usage;
589cdf0e10cSrcweir			exit 1;
590cdf0e10cSrcweir		}
591cdf0e10cSrcweir		elsif ($#ARGV == $i )
592cdf0e10cSrcweir		{
593cdf0e10cSrcweir			$global_output_name = $ARGV[$i];
594cdf0e10cSrcweir		}
595cdf0e10cSrcweir	}
596cdf0e10cSrcweir
597cdf0e10cSrcweir	print "output to $global_output_name\n";
598cdf0e10cSrcweir}
599cdf0e10cSrcweir
600cdf0e10cSrcweir
601cdf0e10cSrcweir###############################################################################
602cdf0e10cSrcweir#	Main
603cdf0e10cSrcweir###############################################################################
604cdf0e10cSrcweir
605cdf0e10cSrcweir$ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
606cdf0e10cSrcweir$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
607cdf0e10cSrcweir#	Provide default values for the zip command and it's flags.
608cdf0e10cSrcweirif ( ! defined $ZipCmd)
609cdf0e10cSrcweir{
610cdf0e10cSrcweir	$ZipCmd = "zip" unless defined $ZipCmd;
611cdf0e10cSrcweir	$ZipFlags = "-r -q" unless defined $ZipFlags;
612cdf0e10cSrcweir}
613cdf0e10cSrcweir
614cdf0e10cSrcweirprocess_command_line();
615cdf0e10cSrcweir
616cdf0e10cSrcweirwriteManifest();
617cdf0e10cSrcweir
618cdf0e10cSrcweir$OUT = open_file( "content.xml" );
619cdf0e10cSrcweir
620cdf0e10cSrcweirwriteHeader();
621cdf0e10cSrcweir
622cdf0e10cSrcweir$slideNum=1;
623cdf0e10cSrcweirforeach $transitionRef (@$transitionsRef)
624cdf0e10cSrcweir{
625cdf0e10cSrcweir	$transitionType = @$transitionRef[0];
626cdf0e10cSrcweir
627cdf0e10cSrcweir	foreach $subtype (@{$transitionRef->[1]})
628cdf0e10cSrcweir	{
629cdf0e10cSrcweir		if( $global_gen_all != 0 )
630cdf0e10cSrcweir		{
631cdf0e10cSrcweir			writeSlideStyles($slideNum++,
632cdf0e10cSrcweir							 $transitionType,
633cdf0e10cSrcweir							 $subtype,
634cdf0e10cSrcweir							 0, 0);
635cdf0e10cSrcweir			writeSlideStyles($slideNum++,
636cdf0e10cSrcweir							 $transitionType,
637cdf0e10cSrcweir							 $subtype,
638cdf0e10cSrcweir							 1, 0);
639cdf0e10cSrcweir			writeSlideStyles($slideNum++,
640cdf0e10cSrcweir							 $transitionType,
641cdf0e10cSrcweir							 $subtype,
642cdf0e10cSrcweir							 0, 1);
643cdf0e10cSrcweir			writeSlideStyles($slideNum++,
644cdf0e10cSrcweir							 $transitionType,
645cdf0e10cSrcweir							 $subtype,
646cdf0e10cSrcweir							 1, 1);
647cdf0e10cSrcweir		}
648cdf0e10cSrcweir		else
649cdf0e10cSrcweir		{
650cdf0e10cSrcweir			writeSlideStyles($slideNum++,
651cdf0e10cSrcweir							 $transitionType,
652cdf0e10cSrcweir							 $subtype,
653cdf0e10cSrcweir							 0, 0);
654cdf0e10cSrcweir		}
655cdf0e10cSrcweir	}
656cdf0e10cSrcweir}
657cdf0e10cSrcweir
658cdf0e10cSrcweirwriteIntermediate();
659cdf0e10cSrcweir
660cdf0e10cSrcweir$slideNum=1;
661cdf0e10cSrcweirforeach $transitionRef (@$transitionsRef)
662cdf0e10cSrcweir{
663cdf0e10cSrcweir	$transitionType = @$transitionRef[0];
664cdf0e10cSrcweir
665cdf0e10cSrcweir	foreach $subtype (@{$transitionRef->[1]})
666cdf0e10cSrcweir	{
667cdf0e10cSrcweir		if( $global_gen_all != 0 )
668cdf0e10cSrcweir		{
669cdf0e10cSrcweir			writeSlide($slideNum++,
670cdf0e10cSrcweir					   $transitionType,
671cdf0e10cSrcweir					   $subtype,
672cdf0e10cSrcweir					   0, 0);
673cdf0e10cSrcweir			writeSlide($slideNum++,
674cdf0e10cSrcweir					   $transitionType,
675cdf0e10cSrcweir					   $subtype,
676cdf0e10cSrcweir					   1, 0);
677cdf0e10cSrcweir			writeSlide($slideNum++,
678cdf0e10cSrcweir					   $transitionType,
679cdf0e10cSrcweir					   $subtype,
680cdf0e10cSrcweir					   0, 1);
681cdf0e10cSrcweir			writeSlide($slideNum++,
682cdf0e10cSrcweir					   $transitionType,
683cdf0e10cSrcweir					   $subtype,
684cdf0e10cSrcweir					   1, 1);
685cdf0e10cSrcweir		}
686cdf0e10cSrcweir		else
687cdf0e10cSrcweir		{
688cdf0e10cSrcweir			writeSlide($slideNum++,
689cdf0e10cSrcweir					   $transitionType,
690cdf0e10cSrcweir					   $subtype,
691cdf0e10cSrcweir					   0, 0);
692cdf0e10cSrcweir		}
693cdf0e10cSrcweir	}
694cdf0e10cSrcweir}
695cdf0e10cSrcweir
696cdf0e10cSrcweirwriteFooter();
697cdf0e10cSrcweir
698cdf0e10cSrcweir$OUT->close;
699cdf0e10cSrcweir
700cdf0e10cSrcweirzip_dirtree ($global_output_name);
701cdf0e10cSrcweir
702