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