xref: /aoo41x/main/slideshow/qa/tools/mkeffects.pl (revision bb113e63)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4# *************************************************************
5#
6#  Licensed to the Apache Software Foundation (ASF) under one
7#  or more contributor license agreements.  See the NOTICE file
8#  distributed with this work for additional information
9#  regarding copyright ownership.  The ASF licenses this file
10#  to you under the Apache License, Version 2.0 (the
11#  "License"); you may not use this file except in compliance
12#  with the License.  You may obtain a copy of the License at
13#
14#    http://www.apache.org/licenses/LICENSE-2.0
15#
16#  Unless required by applicable law or agreed to in writing,
17#  software distributed under the License is distributed on an
18#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19#  KIND, either express or implied.  See the License for the
20#  specific language governing permissions and limitations
21#  under the License.
22#
23# *************************************************************
24
25
26use	IO::File;
27use	Cwd;
28use File::Spec;
29use File::Spec::Functions;
30use File::Temp;
31use File::Path;
32
33$TempDir = "";
34
35
36# all the XML package generation is a blatant rip from AF's
37# write-calc-doc.pl
38
39
40###############################################################################
41#	Open a file with the given name.
42#	First it is checked if the temporary directory, in which all files for
43#	the document are gathered, is already present and create it if it is not.
44#	Then create the path to the file inside the temporary directory.
45#	Finally open the file and return a file handle to it.
46#
47sub	open_file
48{
49	my	$filename = pop @_;
50
51	#	Create base directory of temporary directory tree if not alreay
52	#	present.
53	if ($TempDir eq "")
54	{
55		$TempDir = File::Temp::tempdir (CLEANUP => 1);
56	}
57
58	#	Create the path to the file.
59	my $fullname = File::Spec->catfile ($TempDir, $filename);
60	my ($volume,$directories,$file) = File::Spec->splitpath ($fullname);
61	mkpath (File::Spec->catpath ($volume,$directories,""));
62
63	#	Open the file and return a file handle to it.
64	return new IO::File ($fullname, "w");
65}
66
67
68###############################################################################
69#	Zip the files in the directory tree into the given file.
70#
71sub	zip_dirtree
72{
73	my	$filename = pop @_;
74
75	my	$cwd = getcwd;
76	my	$zip_name = $filename;
77
78	#	We are about to change the directory.
79	#	Therefore create an absolute pathname for the zip archive.
80
81	#	First transfer the drive from $cwd to $zip_name.  This is a
82	#	workaround for a bug in file_name_is_absolute which thinks
83	#	the the path \bla is an absolute path under DOS.
84	my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name);
85	my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd);
86	$volume = $volume_cwd if ($volume eq "");
87	$zip_name = File::Spec->catpath ($volume,$directories,$file);
88
89	#	Add the current working directory to a relative path.
90	if ( ! file_name_is_absolute ($zip_name))
91	{
92		$zip_name = File::Spec->catfile ($cwd, $zip_name);
93
94		#	Try everything to clean up the name.
95		$zip_name = File::Spec->rel2abs ($filename);
96		$zip_name = File::Spec->canonpath ($zip_name);
97
98		#	Remove .. directories from the middle of the path.
99		while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//)
100		{
101			$zip_name = $` . "/" . $';
102		}
103	}
104
105	#	Just in case the zip program gets confused by an existing file with the
106	#	same name as the one to be written that file is removed first.
107	if ( -e $filename)
108	{
109		if (unlink ($filename) == 0)
110		{
111			print "Existing file $filename could not be deleted.\n";
112			print "Please close the application that uses it, then try again.\n";
113			return;
114		}
115	}
116
117	#	Finally create the zip file.  First change into the temporary directory
118	#	so that the resulting zip file contains only paths relative to it.
119	print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
120	chdir ($TempDir);
121	system ("$ZipCmd $ZipFlags $zip_name *");
122	chdir ($cwd);
123}
124
125
126sub writeHeader
127{
128	print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
129
130<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">
131 <office:scripts/>
132 <office:automatic-styles>
133  <style:style style:name="dp1" style:family="drawing-page">
134   <style:drawing-page-properties presentation:background-visible="true" presentation:background-objects-visible="true" presentation:display-footer="true" presentation:display-page-number="false" presentation:display-date-time="true"/>
135  </style:style>
136  <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
137   <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle"/>
138  </style:style>
139  <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
140   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
141  </style:style>
142  <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
143   <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
144  </style:style>
145  <style:style style:name="P1" style:family="paragraph">
146   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
147  </style:style>
148  <style:style style:name="P2" style:family="paragraph">
149   <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
150  </style:style>
151  <text:list-style style:name="L1">
152   <text:list-level-style-bullet text:level="1" text:bullet-char="●">
153    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
154   </text:list-level-style-bullet>
155   <text:list-level-style-bullet text:level="2" text:bullet-char="●">
156    <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
157    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
158   </text:list-level-style-bullet>
159   <text:list-level-style-bullet text:level="3" text:bullet-char="●">
160    <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
161    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
162   </text:list-level-style-bullet>
163   <text:list-level-style-bullet text:level="4" text:bullet-char="●">
164    <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
165    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
166   </text:list-level-style-bullet>
167   <text:list-level-style-bullet text:level="5" text:bullet-char="●">
168    <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
169    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
170   </text:list-level-style-bullet>
171   <text:list-level-style-bullet text:level="6" text:bullet-char="●">
172    <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
173    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
174   </text:list-level-style-bullet>
175   <text:list-level-style-bullet text:level="7" text:bullet-char="●">
176    <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
177    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
178   </text:list-level-style-bullet>
179   <text:list-level-style-bullet text:level="8" text:bullet-char="●">
180    <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
181    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
182   </text:list-level-style-bullet>
183   <text:list-level-style-bullet text:level="9" text:bullet-char="●">
184    <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
185    <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
186   </text:list-level-style-bullet>
187  </text:list-style>
188 </office:automatic-styles>
189 <office:body>
190  <office:presentation>
191~;
192
193}
194
195sub writeSlideHeader
196{
197	my $titleText = pop @_;
198	my $slideNum = pop @_;
199
200	print $OUT "      <draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n";
201	print $OUT "       <office:forms form:automatic-focus=\"false\" form:apply-design-mode=\"false\"/>\n";
202	print $OUT "       <draw:rect draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:id=\"id$slideNum\" draw:layer=\"layout\" svg:width=\"17.5cm\" svg:height=\"13cm\" svg:x=\"5cm\" svg:y=\"4cm\">\n";
203	print $OUT "        <text:p text:style-name=\"P2\">Slide: $slideNum</text:p>\n";
204	print $OUT "        <text:p text:style-name=\"P2\">Topic: $titleText</text:p>\n";
205	print $OUT "        <text:p text:id=\"textid$slideNum\" text:style-name=\"P2\">Some text to show text effects</text:p>\n";
206	print $OUT "       </draw:rect>\n";
207	print $OUT "      <anim:par presentation:node-type=\"timing-root\">\n";
208	print $OUT "        <anim:seq presentation:node-type=\"main-sequence\">\n";
209}
210
211
212sub writeSlideFooter
213{
214	print $OUT "       </anim:seq>\n";
215	print $OUT "      </anim:par>\n";
216	print $OUT "    <presentation:notes draw:style-name=\"dp1\">\n";
217	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";
218	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";
219	print $OUT "      <draw:text-box/>\n";
220	print $OUT "     </draw:frame>\n";
221	print $OUT "    </presentation:notes>\n";
222	print $OUT "   </draw:page>\n";
223}
224
225sub writeFooter
226{
227	print $OUT qq~   <presentation:settings presentation:full-screen="false"/>
228  </office:presentation>
229 </office:body>
230</office:document-content>
231~;
232
233}
234
235sub writeTransitionAnimation
236{
237	my $transitionSubtype = pop @_;
238	my $transitionType = pop @_;
239	my $slideNum = pop @_;
240
241	print $OUT "          <anim:par smil:begin=\"0s\" smil:fill=\"remove\">\n";
242	print $OUT "            <anim:set smil:begin=\"0s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
243    print $OUT "            <anim:transitionFilter smil:dur=\"1s\" smil:targetElement=\"textid$slideNum\" smil:type=\"$transitionType\" smil:subtype=\"$transitionSubtype\"/>\n";
244	print $OUT "            <anim:set smil:begin=\"0.3s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
245    print $OUT "            <anim:transitionFilter smil:begin=\"0.3s\" smil:dur=\"1s\" smil:targetElement=\"id$slideNum\" smil:type=\"$transitionType\" smil:subtype=\"$transitionSubtype\"/>\n";
246    print $OUT "          </anim:par>\n";
247}
248
249sub writePropertyAnimation
250{
251	my $propertyEnd = pop @_;
252	my $propertyStart = pop @_;
253	my $propertyName = pop @_;
254	my $slideNum = pop @_;
255
256	print $OUT "          <anim:par smil:begin=\"0s\" smil:dur=\"3s\" smil:fill=\"remove\">\n";
257	print $OUT "            <anim:set smil:begin=\"0s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
258    print $OUT "            <anim:animate smil:begin=\"0s\" smil:dur=\"1s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" smil:attributeName=\"$propertyName\" smil:values=\"$propertyStart;$propertyEnd\" smil:keyTimes=\"0;1\" presentation:additive=\"base\"/>\n";
259	print $OUT "            <anim:set smil:begin=\"0.6s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
260    print $OUT "            <anim:animate smil:begin=\"0.6s\" smil:dur=\"1s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" smil:attributeName=\"$propertyName\" smil:values=\"$propertyStart;$propertyEnd\" smil:keyTimes=\"0;1\" presentation:additive=\"base\"/>\n";
261    print $OUT "          </anim:par>\n";
262}
263
264sub writeTransformAnimation
265{
266	my $propertyBy = pop @_;
267	my $propertyName = pop @_;
268	my $slideNum = pop @_;
269
270	print $OUT "          <anim:par smil:begin=\"0s\" smil:dur=\"3s\" smil:fill=\"remove\">\n";
271	print $OUT "            <anim:set smil:begin=\"0s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
272    print $OUT "            <anim:animateTransform smil:begin=\"0s\" smil:dur=\"1s\" smil:targetElement=\"id$slideNum\" smil:fill=\"hold\" smil:by=\"$propertyBy\" presentation:additive=\"base\" svg:type=\"$propertyName\"/>\n";
273	print $OUT "            <anim:set smil:begin=\"0.6s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
274    print $OUT "            <anim:animateTransform smil:begin=\"0.6s\" smil:dur=\"1s\" smil:targetElement=\"textid$slideNum\" smil:fill=\"hold\" smil:by=\"$propertyBy\" presentation:additive=\"base\" svg:type=\"$propertyName\"/>\n";
275    print $OUT "          </anim:par>\n";
276}
277
278sub writePathMotionAnimation
279{
280	my $slideNum = pop @_;
281
282	print $OUT "          <anim:par smil:begin=\"0s\" smil:dur=\"10s\" smil:fill=\"remove\">\n";
283	print $OUT "            <anim:set smil:begin=\"0s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
284    print $OUT "            <anim:animateMotion smil:dur=\"5s\" smil:fill=\"hold\" smil:targetElement=\"id$slideNum\" presentation:additive=\"base\" svg:path=\"m0.0 0.07658c0.0098-0.00493 0.00197-0.00985 0.00295-0.01478 0.00191 0.00 0.00383 0.00 0.00574 0.00-0.00005 0.00033-0.00011 0.00065-0.00016 0.00098-0.00034 0.00276-0.00060 0.00446-0.00077 0.00512-0.00021 0.00086-0.00031 0.00143-0.00031 0.00170 0.00 0.00200 0.00150 0.00369 0.00452 0.00507 0.00301 0.00138 0.00671 0.00206 0.01108 0.00206 0.00438 0.00 0.00816-0.00164 0.01134-0.00493 0.00319-0.00329 0.00478-0.00719 0.00478-0.01170 0.00-0.00514-0.00311-0.01022-0.00935-0.01525-0.00162-0.00129-0.00324-0.00258-0.00486-0.00387-0.00806-0.00651-0.01209-0.01290-0.01209-0.01917s0.0251-0.01148 0.00752-0.01561 0.01131-0.00620 0.01889-0.00620c0.0585 0.00 0.01276 0.00126 0.02072 0.00377-0.00102 0.00512-0.00203 0.01023-0.00305 0.01535-0.00191 0.00-0.00383 0.00-0.00574 0.00 0.00009-0.00052 0.00017-0.00103 0.00026-0.00155 0.00019-0.00195 0.00038-0.00389 0.00057-0.00584 0.00009-0.00062 0.00017-0.00124 0.00026-0.00186-0.00014-0.00183-0.00155-0.00337-0.00424-0.00462-0.00269-0.00126-0.00589-0.00189-0.00961-0.00189-0.00424 0.00-0.00782 0.00144-0.01075 0.00431-0.00293 0.00288-0.00439 0.00640-0.00439 0.01057 0.00 0.00510 0.00334 0.01035 0.01002 0.01576 0.00172 0.00138 0.00345 0.00275 0.00517 0.00413 0.00782 0.00631 0.01173 0.01277 0.01173 0.01938 0.00 0.00675-0.00272 0.01224-0.00816 0.01646-0.00545 0.00422-0.01256 0.00633-0.02134 0.00633-0.00538 0.00-0.01165-0.00105-0.01881-0.00315-0.00064-0.00019-0.00128-0.00038-0.00192-0.00057z\"/>\n";
285	print $OUT "            <anim:set smil:begin=\"3.6s\" smil:dur=\"0.001s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" smil:attributeName=\"visibility\" smil:to=\"visible\"/>\n";
286    print $OUT "            <anim:animateMotion smil:begin=\"3.6s\" smil:dur=\"5s\" smil:fill=\"hold\" smil:targetElement=\"textid$slideNum\" presentation:additive=\"base\" svg:path=\"m0.0 0.07658c0.0098-0.00493 0.00197-0.00985 0.00295-0.01478 0.00191 0.00 0.00383 0.00 0.00574 0.00-0.00005 0.00033-0.00011 0.00065-0.00016 0.00098-0.00034 0.00276-0.00060 0.00446-0.00077 0.00512-0.00021 0.00086-0.00031 0.00143-0.00031 0.00170 0.00 0.00200 0.00150 0.00369 0.00452 0.00507 0.00301 0.00138 0.00671 0.00206 0.01108 0.00206 0.00438 0.00 0.00816-0.00164 0.01134-0.00493 0.00319-0.00329 0.00478-0.00719 0.00478-0.01170 0.00-0.00514-0.00311-0.01022-0.00935-0.01525-0.00162-0.00129-0.00324-0.00258-0.00486-0.00387-0.00806-0.00651-0.01209-0.01290-0.01209-0.01917s0.0251-0.01148 0.00752-0.01561 0.01131-0.00620 0.01889-0.00620c0.0585 0.00 0.01276 0.00126 0.02072 0.00377-0.00102 0.00512-0.00203 0.01023-0.00305 0.01535-0.00191 0.00-0.00383 0.00-0.00574 0.00 0.00009-0.00052 0.00017-0.00103 0.00026-0.00155 0.00019-0.00195 0.00038-0.00389 0.00057-0.00584 0.00009-0.00062 0.00017-0.00124 0.00026-0.00186-0.00014-0.00183-0.00155-0.00337-0.00424-0.00462-0.00269-0.00126-0.00589-0.00189-0.00961-0.00189-0.00424 0.00-0.00782 0.00144-0.01075 0.00431-0.00293 0.00288-0.00439 0.00640-0.00439 0.01057 0.00 0.00510 0.00334 0.01035 0.01002 0.01576 0.00172 0.00138 0.00345 0.00275 0.00517 0.00413 0.00782 0.00631 0.01173 0.01277 0.01173 0.01938 0.00 0.00675-0.00272 0.01224-0.00816 0.01646-0.00545 0.00422-0.01256 0.00633-0.02134 0.00633-0.00538 0.00-0.01165-0.00105-0.01881-0.00315-0.00064-0.00019-0.00128-0.00038-0.00192-0.00057z\"/>\n";
287    print $OUT "          </anim:par>\n";
288}
289
290sub writeManifest
291{
292	my $outFile = open_file("META-INF/manifest.xml");
293
294	print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
295<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
296<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
297 <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
298 <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
299</manifest:manifest>
300~;
301
302	$outFile->close;
303}
304
305
306###############################################################################
307#	Print usage information.
308#
309sub	usage	()
310{
311	print <<END_OF_USAGE;
312usage: $0 <option>* [<output-file-name>]
313
314output-file-name defaults to alltransitions.odp.
315
316options: -a    Generate _all_ combinations of type, subtype,
317               direction, and mode
318         -h    Print this usage information.
319END_OF_USAGE
320}
321
322###############################################################################
323#	Process the command line.
324#
325sub	process_command_line
326{
327	foreach (@ARGV)
328	{
329		if (/^-h/)
330		{
331			usage;
332			exit 0;
333		}
334	}
335
336	$global_gen_all=0;
337	$global_output_name = "alltransitions.odp";
338
339	my	$j = 0;
340	for (my $i=0; $i<=$#ARGV; $i++)
341	{
342		if ($ARGV[$i] eq "-a")
343		{
344			$global_gen_all=1;
345		}
346		elsif ($ARGV[$i] =~ /^-/)
347		{
348		    print "Unknown option $ARGV[$i]\n";
349			usage;
350			exit 1;
351		}
352		elsif ($#ARGV == $i )
353		{
354			$global_output_name = $ARGV[$i];
355		}
356	}
357
358	print "output to $global_output_name\n";
359}
360
361$transitionsRef = [
362
363				["barWipe",
364				 ["leftToRight",
365				  "topToBottom"]],
366
367				["blindsWipe",
368				 ["vertical",
369				  "horizontal"]],
370
371				["boxWipe",
372				 ["topLeft",
373				  "topRight",
374				  "bottomRight",
375				  "bottomLeft",
376				  "topCenter",
377				  "rightCenter",
378				  "bottomCenter",
379				  "leftCenter"]],
380
381				["fourBoxWipe",
382				 ["cornersIn",
383				  "cornersOut"]],
384
385				["barnDoorWipe",
386				 ["vertical",
387				  "horizontal",
388				  "diagonalBottomLeft",
389				  "diagonalTopLeft"]],
390
391				["bowTieWipe",
392				 ["vertical",
393				  "horizontal"]],
394
395				["miscDiagonalWipe",
396				 ["doubleBarnDoor",
397				  "doubleDiamond"]],
398
399				["veeWipe",
400				 ["down",
401				  "left",
402				  "up",
403				  "right"]],
404
405				["barnVeeWipe",
406				 ["top",
407				  "left",
408				  "up",
409				  "right"]],
410
411				["zigZagWipe",
412				 ["leftToRight",
413				  "topToBottom"]],
414
415				["barnZigZagWipe",
416				 ["vertical",
417				  "horizontal"]],
418
419				["irisWipe",
420				 ["rectangle",
421				  "diamond"]],
422
423				["triangleWipe",
424				 ["up",
425				  "right",
426				  "down",
427				  "left"]],
428
429				["arrowHeadWipe",
430				 ["up",
431				  "right",
432				  "down",
433				  "left"]],
434
435				["pentagonWipe",
436				 ["up",
437				  "down"]],
438
439				["hexagonWipe",
440				 ["horizontal",
441				  "vertical"]],
442
443				["ellipseWipe",
444				 ["circle",
445				  "horizontal",
446				  "vertical"]],
447
448				["eyeWipe",
449				 ["vertical",
450				  "horizontal"]],
451
452				["roundRectWipe",
453				 ["horizontal",
454				  "vertical"]],
455
456				["starWipe",
457				 ["fourPoint",
458				  "fivePoint",
459				  "sixPoint"]],
460
461				["miscShapeWipe",
462				 ["heart",
463				  "keyhole"]],
464
465				["clockWipe",
466				 ["clockwiseTwelve",
467				  "clockwiseThree",
468				  "clockwiseSix",
469				  "clockwiseNine"]],
470
471				["pinWheelWipe",
472				 ["oneBlade",
473				  "twoBladeVertical",
474				  "twoBladeHorizontal",
475				  "threeBlade",
476				  "fourBlade",
477				  "eightBlade"]],
478
479				["singleSweepWipe",
480				 ["clockwiseTop",
481				  "clockwiseRight",
482				  "clockwiseBottom",
483				  "clockwiseLeft",
484				  "clockwiseTopLeft",
485				  "counterClockwiseBottomLeft",
486				  "clockwiseBottomRight",
487				  "counterClockwiseTopRight"]],
488
489				["fanWipe",
490				 ["centerTop",
491				  "centerRight",
492				  "top",
493				  "right",
494				  "bottom",
495				  "left"]],
496
497				["doubleFanWipe",
498				 ["fanOutVertical",
499				  "fanOutHorizontal",
500				  "fanInVertical",
501				  "fanInHorizontal"]],
502
503				["doubleSweepWipe",
504				 ["parallelVertical",
505				  "parallelDiagonal",
506				  "oppositeVertical",
507				  "oppositeHorizontal",
508				  "parallelDiagonalTopLeft",
509				  "parallelDiagonalBottomLeft"]],
510
511				["saloonDoorWipe",
512				 ["top",
513				  "left",
514				  "bottom",
515				  "right"]],
516
517				["windshieldWipe",
518				 ["right",
519				  "up",
520				  "vertical",
521				  "horizontal"]],
522
523				["snakeWipe",
524				 ["topLeftHorizontal",
525				  "topLeftVertical",
526				  "topLeftDiagonal",
527				  "topRightDiagonal",
528				  "bottomRightDiagonal",
529				  "bottomLeftDiagonal"]],
530
531				["spiralWipe",
532				 ["topLeftClockwise",
533				  "topRightClockwise",
534				  "bottomRightClockwise",
535				  "bottomLeftClockwise",
536				  "topLeftCounterClockwise",
537				  "topRightCounterClockwise",
538				  "bottomRightCounterClockwise",
539				  "bottomLeftCounterClockwise"]],
540
541				["parallelSnakesWipe",
542				 ["verticalTopSame",
543				  "verticalBottomSame",
544				  "verticalTopLeftOpposite",
545				  "verticalBottomLeftOpposite",
546				  "horizontalLeftSame",
547				  "horizontalRightSame",
548				  "horizontalTopLeftOpposite",
549				  "horizontalTopRightOpposite",
550				  "diagonalBottomLeftOpposite",
551				  "diagonalTopLeftOpposite"]],
552
553				["boxSnakesWipe",
554				 ["twoBoxTop",
555				  "twoBoxLeft",
556				  "twoBoxRight",
557				  "fourBoxVertical",
558				  "fourBoxHorizontal"]],
559
560				["waterfallWipe",
561				 ["verticalLeft",
562				  "verticalRight",
563				  "horizontalLeft",
564				  "horizontalRight"]],
565
566			   ["pushWipe",
567				 ["fromLeft",
568				  "fromTop",
569				  "fromRight",
570				  "fromBottom",
571				  "fromBottomRight",
572				  "fromBottomLeft",
573				  "fromTopRight",
574				  "fromTopLeft",
575				  "combHorizontal",
576				  "combVertical"]],
577
578				["slideWipe",
579				 ["fromLeft",
580				  "fromTop",
581				  "fromRight",
582				  "fromBottom"]],
583
584				["fade",
585				 ["crossfade",
586				  "fadeToColor",
587				  "fadeFromColor",
588				  "fadeOverColor"]],
589
590				["randomBarWipe",
591				 ["vertical",
592				  "horizontal"]],
593
594				["checkerBoardWipe",
595				 ["down",
596				  "across"]],
597
598				["dissolve",
599				 ["default"]]
600];
601
602$propertiesRef = [
603                    [ "value", "color", "#000000", "#FF0000" ],
604
605                    [ "string", "font-family",  "Helvetica",  "Times New Roman" ],
606
607                    [ "value", "font-size", "1pt", "1.5pt" ],
608
609                    [ "string", "font-style", "normal", "italic" ],
610
611                    [ "string", "text-underline", "none", "solid" ],
612
613                    [ "string", "font-weight", "normal", "bold" ],
614
615                    [ "value", "fill-color", "#000000", "#00FF00" ],
616
617                    [ "string", "fill", "none", "solid" ],
618
619                    [ "value", "height", "0.5*height", "height" ],
620
621                    [ "value", "stroke-color", "#000000", "#0000FF" ],
622
623                    [ "string", "stroke", "none", "solid" ],
624
625                    [ "value", "opacity", "0.0", "0.9" ],
626
627                    [ "value", "rotate", "0", "90" ],
628
629                    [ "value", "skewX", "0", "-1" ],
630
631                    [ "value", "skewY", "0", "-1" ],
632
633                    [ "string", "visibility", "hidden", "visible" ],
634
635                    [ "value", "width", "0.5*width", "width" ],
636
637                    [ "value", "x", "x-0.1", "x+0.1" ],
638
639                    [ "value", "y", "y-0.1", "y+0.1" ]
640    ];
641
642$transformsRef = [
643    ["translate", "0.5*width,0.5*height"],
644    ["scale", "0.5*width,0.5*height"],
645    ["rotate", "270"],
646    ["skewX", "-1"],
647    ["skewY", "1"]
648];
649
650
651###############################################################################
652#	Main
653###############################################################################
654
655$ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
656$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
657#	Provide default values for the zip command and it's flags.
658if ( ! defined $ZipCmd)
659{
660	$ZipCmd = "zip" unless defined $ZipCmd;
661	$ZipFlags = "-r -q" unless defined $ZipFlags;
662}
663
664process_command_line();
665
666writeManifest();
667
668$OUT = open_file( "content.xml" );
669
670writeHeader();
671
672$transitionNum=0;
673writeSlideHeader($transitionNum, "Transition effects");
674
675foreach $transitionRef (@$transitionsRef)
676{
677	$transitionType = @$transitionRef[0];
678
679	foreach $subtype (@{$transitionRef->[1]})
680	{
681        writeTransitionAnimation($transitionNum,
682                                 $transitionType,
683                                 $subtype);
684    }
685}
686
687writeSlideFooter();
688
689writeSlideHeader(++$transitionNum, "Property effects");
690
691foreach $propertyRef (@$propertiesRef)
692{
693	$propertyType = @$propertyRef[0];
694
695    if( $propertyType eq "value" )
696    {
697        writePropertyAnimation( $transitionNum, @$propertyRef[1], @$propertyRef[2], @$propertyRef[3] );
698    }
699    elsif( $propertyType eq "string" )
700    {
701    }
702    else
703    {
704        die "Unexpected case";
705    }
706}
707
708writeSlideFooter();
709
710writeSlideHeader(++$transitionNum, "Transformation effects");
711
712foreach $transformRef (@$transformsRef)
713{
714    writeTransformAnimation( $transitionNum, @$transformRef[0], @$transformRef[1] );
715}
716
717writeSlideFooter();
718
719writeSlideHeader(++$transitionNum, "Path motion effects");
720writePathMotionAnimation($transitionNum);
721writeSlideFooter();
722
723	print $OUT qq~
724    <draw:page draw:name="page1" draw:style-name="dp1" draw:master-page-name="Default">
725       <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
726       <draw:rect draw:style-name="gr1" draw:text-style-name="P1" draw:id="id10000" draw:layer="layout" svg:width="17.5cm" svg:height="13cm" svg:x="5cm" svg:y="4cm">
727        <text:p text:style-name="P2">Slide: 4</text:p>
728        <text:p text:style-name="P2">Topic: Misc effects</text:p>
729        <text:p text:id="textid10001" text:style-name="P2">Some text to show accelerate effects</text:p>
730        <text:p text:id="textid10002" text:style-name="P2">Some text to show decelerate effects</text:p>
731        <text:p text:id="textid10003" text:style-name="P2">Some text to show additive effects</text:p>
732        <text:p text:id="textid10004" text:style-name="P2">Some text to show autoreverse effects</text:p>
733        <text:p text:id="textid10005" text:style-name="P2">Some text to show key value effects</text:p>
734        <text:p text:id="textid10006" text:style-name="P2">Some text to show discrete key value effects</text:p>
735        <text:p text:id="textid10007" text:style-name="P2">Some text to show formula effects</text:p>
736       </draw:rect>
737      <anim:par presentation:node-type="timing-root">
738        <anim:seq presentation:node-type="main-sequence">
739
740          <anim:par smil:begin="0s" smil:fill="remove">
741            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10001" smil:attributeName="visibility" smil:to="visible"/>
742            <anim:animate smil:begin="0s" smil:dur="10s" smil:fill="hold" smil:targetElement="textid10001" smil:accelerate="0.5" smil:attributeName="x" smil:by="0.3" presentation:additive="base"/>
743          </anim:par>
744
745          <anim:par smil:begin="0s" smil:fill="remove">
746            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10002" smil:attributeName="visibility" smil:to="visible"/>
747            <anim:animate smil:begin="0s" smil:dur="10s" smil:fill="hold" smil:targetElement="textid10002" smil:decelerate="0.5" smil:attributeName="x" smil:by="0.3" presentation:additive="base"/>
748          </anim:par>
749
750          <anim:par smil:begin="0s" smil:fill="remove">
751            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10003" smil:attributeName="visibility" smil:to="visible"/>
752            <anim:animate smil:begin="0s" smil:dur="3s" smil:fill="hold" smil:targetElement="textid10003" smil:attributeName="x" smil:to="0.3" presentation:additive="sum"/>
753            <anim:animate smil:begin="0s" smil:dur="6s" smil:fill="hold" smil:targetElement="textid10003" smil:attributeName="x" smil:to="0.3" presentation:additive="sum"/>
754          </anim:par>
755
756          <anim:par smil:begin="0s" smil:fill="remove">
757            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10004" smil:attributeName="visibility" smil:to="visible"/>
758            <anim:animate smil:begin="0s" smil:dur="5s" smil:fill="hold" smil:targetElement="textid10004" smil:attributeName="y" smil:from="0.3" smil:to="0.8" smil:autoReverse="true" presentation:additive="base"/>
759          </anim:par>
760
761          <anim:par smil:begin="0s" smil:fill="remove">
762            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10005" smil:attributeName="visibility" smil:to="visible"/>
763            <anim:animateTransform smil:begin="0s" smil:dur="10s" smil:fill="hold" smil:targetElement="textid10005" smil:values="0.5,0.5;0.8,0.5;0.8,0.8;0.5,0.5" smil:keyTimes="0;0.3;0.6;1" presentation:additive="base" svg:type="translate"/>
764          </anim:par>
765
766          <anim:par smil:begin="0s" smil:fill="remove">
767            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10006" smil:attributeName="visibility" smil:to="visible"/>
768            <anim:animateTransform smil:begin="0s" smil:dur="10s" smil:fill="hold" smil:targetElement="textid10006" smil:values="0.5,0.5;0.8,0.5;0.8,0.8;0.5,0.5" smil:keyTimes="0;0.3;0.6;1" smil:calcMode="discrete" presentation:additive="base" svg:type="translate"/>
769          </anim:par>
770
771          <anim:par smil:begin="0s" smil:fill="remove">
772            <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:targetElement="textid10007" smil:attributeName="visibility" smil:to="visible"/>
773            <anim:animate smil:begin="0s" smil:dur="3s" smil:fill="hold" smil:targetElement="textid10007" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y+0.3*height*sin(5*pi*\$)" presentation:additive="base"/>
774          </anim:par>
775~;
776
777writeSlideFooter();
778
779# iterate, single paragraphs, word, lines, sentences, characters
780
781	print $OUT qq~
782    <draw:page draw:name="page1" draw:style-name="dp1" draw:master-page-name="Default">
783       <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
784       <draw:rect draw:style-name="gr1" draw:text-style-name="P1" draw:id="id20000" draw:layer="layout" svg:width="17.5cm" svg:height="13cm" svg:x="5cm" svg:y="4cm">
785        <text:p text:style-name="P2">Slide: 5</text:p>
786        <text:p text:style-name="P2">Topic: Text effects</text:p>
787        <text:p text:id="textid20001" text:style-name="P2">Some text to show iterated single paragraph</text:p>
788        <text:p text:id="textid20002" text:style-name="P2">Some text to show iterated word-by-word effects</text:p>
789        <text:p text:id="textid20003" text:style-name="P2">Some text to show iterated letter-by-letter effects</text:p>
790        <text:p text:id="textid20004" text:style-name="P2">Some more text</text:p>
791        <text:p text:id="textid20005" text:style-name="P2">Some more text</text:p>
792        <text:p text:id="textid20006" text:style-name="P2">Some more text</text:p>
793        <text:p text:id="textid20007" text:style-name="P2">Some more text</text:p>
794        <text:p text:id="textid20008" text:style-name="P2">Some more text</text:p>
795       </draw:rect>
796      <anim:par presentation:node-type="timing-root">
797        <anim:seq presentation:node-type="main-sequence">
798
799          <anim:par smil:begin="0s" smil:fill="remove">
800            <anim:iterate smil:begin="0s" smil:fill="hold" smil:targetElement="id20000" anim:iterate-type="by-paragraph" anim:iterate-interval="0.2s">
801               <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
802               <anim:animate smil:begin="0s" smil:dur="2s" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:from="1.0" smil:to="x" presentation:additive="base"/>
803            </anim:iterate>
804          </anim:par>
805
806          <anim:par smil:begin="0s" smil:fill="remove">
807            <anim:set smil:begin="0s" smil:dur="0.001s" smil:targetElement="id20000" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
808            <anim:iterate smil:begin="0s" smil:fill="hold" smil:targetElement="textid20002" anim:iterate-type="by-word" anim:iterate-interval="0.2s">
809               <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
810               <anim:animate smil:begin="0s" smil:dur="2s" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:from="1.0" smil:to="x" presentation:additive="base"/>
811            </anim:iterate>
812          </anim:par>
813
814          <anim:par smil:begin="0s" smil:fill="remove">
815            <anim:set smil:begin="0s" smil:dur="0.001s" smil:targetElement="id20000" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
816            <anim:iterate smil:begin="0s" smil:fill="hold" smil:targetElement="textid20003" anim:iterate-type="by-letter" anim:iterate-interval="0.2s">
817               <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/>
818               <anim:animate smil:begin="0s" smil:dur="2s" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:from="1.0" smil:to="x" presentation:additive="base"/>
819            </anim:iterate>
820          </anim:par>
821~;
822
823writeSlideFooter();
824
825writeFooter();
826
827$OUT->close;
828
829zip_dirtree ($global_output_name);
830
831