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