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