2 eval 'exec perl -wS $0 ${1+"$@"}'
9 use File
::Spec
::Functions
;
16 # all the XML package generation is a blatant rip from AF's
20 ###############################################################################
21 # Open a file with the given name.
22 # First it is checked if the temporary directory, in which all files for
23 # the document are gathered, is already present and create it if it is not.
24 # Then create the path to the file inside the temporary directory.
25 # Finally open the file and return a file handle to it.
29 my $filename = pop @_;
31 # Create base directory of temporary directory tree if not alreay
35 $TempDir = File
::Temp
::tempdir
(CLEANUP
=> 1);
38 # Create the path to the file.
39 my $fullname = File
::Spec
->catfile ($TempDir, $filename);
40 my ($volume,$directories,$file) = File
::Spec
->splitpath ($fullname);
41 mkpath
(File
::Spec
->catpath ($volume,$directories,""));
43 # Open the file and return a file handle to it.
44 return new IO
::File
($fullname, "w");
48 ###############################################################################
49 # Zip the files in the directory tree into the given file.
53 my $filename = pop @_;
56 my $zip_name = $filename;
58 # We are about to change the directory.
59 # Therefore create an absolute pathname for the zip archive.
61 # First transfer the drive from $cwd to $zip_name. This is a
62 # workaround for a bug in file_name_is_absolute which thinks
63 # the the path \bla is an absolute path under DOS.
64 my ($volume,$directories,$file) = File
::Spec
->splitpath ($zip_name);
65 my ($volume_cwd,$directories_cwd,$file_cwd) = File
::Spec
->splitpath ($cwd);
66 $volume = $volume_cwd if ($volume eq "");
67 $zip_name = File
::Spec
->catpath ($volume,$directories,$file);
69 # Add the current working directory to a relative path.
70 if ( ! file_name_is_absolute
($zip_name))
72 $zip_name = File
::Spec
->catfile ($cwd, $zip_name);
74 # Try everything to clean up the name.
75 $zip_name = File
::Spec
->rel2abs ($filename);
76 $zip_name = File
::Spec
->canonpath ($zip_name);
78 # Remove .. directories from the middle of the path.
79 while ($zip_name =~ /\/[^\
/][^\.\/][^\
/]*\/\
.\
.\
//)
81 $zip_name = $` . "/" . $';
85 # Just in case the zip program gets confused by an existing file with the
86 # same name as the one to be written that file is removed first.
89 if (unlink ($filename) == 0)
91 print "Existing file $filename could not be deleted.\n";
92 print "Please close the application that uses it, then try again.\n";
97 # Finally create the zip file. First change into the temporary directory
98 # so that the resulting zip file contains only paths relative to it.
99 print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
101 system ("$ZipCmd $ZipFlags $zip_name *");
109 print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
111 <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">
113 <office:automatic-styles>
121 my $direction = pop @_;
122 my $transitionSubType = pop @_;
123 my $transitionType = pop @_;
124 my $slideNum = pop @_;
126 print $OUT " <style:style style:name=\"dp",$slideNum,"\" style:family=\"drawing-page\">\n";
127 print $OUT " <style:drawing-page-properties presentation:transition-type=\"automatic\" presentation:duration=\"PT00H00M01S\" presentation:background-visible=\"true\" presentation:background-objects-visible=\"true\" draw:fill=\"solid\" draw:fill-color=\"#ff",$slideNum % 2 ? "ff99" : "cc99","\" smil:type=\"",$transitionType,"\" smil:subtype=\"",$transitionSubType,"\" ",$direction == 0 ? "" : "smil:direction=\"reverse\" ",$mode == 0 ? "" : "smil:mode=\"out\"","/>\n";
128 print $OUT " </style:style>\n";
131 sub writeIntermediate
133 print $OUT qq~ <style:style style:name="gr1" style:family="graphic">
134 <style:graphic-properties style:protect="size"/>
136 <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
137 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
139 <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
140 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
142 <style:style style:name="P1" style:family="paragraph">
143 <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
145 <style:style style:name="P2" style:family="paragraph">
146 <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
148 <text:list-style style:name="L1">
149 <text:list-level-style-bullet text:level="1" text:bullet-char="●">
150 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
151 </text:list-level-style-bullet>
152 <text:list-level-style-bullet text:level="2" text:bullet-char="●">
153 <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
154 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
155 </text:list-level-style-bullet>
156 <text:list-level-style-bullet text:level="3" text:bullet-char="●">
157 <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
158 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
159 </text:list-level-style-bullet>
160 <text:list-level-style-bullet text:level="4" text:bullet-char="●">
161 <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
162 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
163 </text:list-level-style-bullet>
164 <text:list-level-style-bullet text:level="5" text:bullet-char="●">
165 <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
166 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
167 </text:list-level-style-bullet>
168 <text:list-level-style-bullet text:level="6" text:bullet-char="●">
169 <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
170 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
171 </text:list-level-style-bullet>
172 <text:list-level-style-bullet text:level="7" text:bullet-char="●">
173 <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
174 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
175 </text:list-level-style-bullet>
176 <text:list-level-style-bullet text:level="8" text:bullet-char="●">
177 <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
178 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
179 </text:list-level-style-bullet>
180 <text:list-level-style-bullet text:level="9" text:bullet-char="●">
181 <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
182 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
183 </text:list-level-style-bullet>
185 </office:automatic-styles>
187 <office:presentation>
195 my $direction = pop @_;
196 my $transitionSubtype = pop @_;
197 my $transitionType = pop @_;
198 my $slideNum = pop @_;
200 print $OUT " <draw:page draw:name=\"page",$slideNum,"\" draw:style-name=\"dp",$slideNum,"\" draw:master-page-name=\"Default\" presentation:presentation-page-layout-name=\"AL1T19\">";
202 print $OUT " <draw:frame presentation:style-name=\"pr1\" draw:layer=\"layout\" svg:width=\"25.199cm\" svg:height=\"3.256cm\" svg:x=\"1.4cm\" svg:y=\"0.962cm\" presentation:class=\"title\">\n";
203 print $OUT " <draw:text-box>\n";
204 print $OUT " <text:p text:style-name=\"P1\">Transition “",$slideNum-1,"”</text:p>\n";
205 print $OUT " </draw:text-box>\n";
206 print $OUT " </draw:frame>\n";
207 print $OUT " <draw:frame presentation:style-name=\"pr2\" draw:layer=\"layout\" svg:width=\"25.199cm\" svg:height=\"13.609cm\" svg:x=\"1.4cm\" svg:y=\"4.914cm\" presentation:class=\"outline\">\n";
208 print $OUT " <draw:text-box>\n";
209 print $OUT " <text:list text:style-name=\"L2\">\n";
210 print $OUT " <text:list-item>\n";
211 print $OUT " <text:p text:style-name=\"P2\">Transition: ",$transitionType,"</text:p>\n";
212 print $OUT " </text:list-item>\n";
213 print $OUT " </text:list>\n";
214 print $OUT " <text:list text:style-name=\"L2\">\n";
215 print $OUT " <text:list-item>\n";
216 print $OUT " <text:list>\n";
217 print $OUT " <text:list-item>\n";
218 print $OUT " <text:p text:style-name=\"P3\">Subtype: ",$transitionSubtype,"</text:p>\n";
219 print $OUT " </text:list-item>\n";
220 print $OUT " </text:list>\n";
221 print $OUT " </text:list-item>\n";
222 print $OUT " </text:list>\n";
223 print $OUT " <text:list text:style-name=\"L2\">\n";
224 print $OUT " <text:list-item>\n";
225 print $OUT " <text:list>\n";
226 print $OUT " <text:list-item>\n";
227 print $OUT " <text:p text:style-name=\"P3\">Direction: ",$direction == 0 ? "forward" : "reverse","</text:p>\n";
228 print $OUT " </text:list-item>\n";
229 print $OUT " </text:list>\n";
230 print $OUT " </text:list-item>\n";
231 print $OUT " </text:list>\n";
232 print $OUT " <text:list text:style-name=\"L2\">\n";
233 print $OUT " <text:list-item>\n";
234 print $OUT " <text:list>\n";
235 print $OUT " <text:list-item>\n";
236 print $OUT " <text:p text:style-name=\"P3\">Mode: ",$mode == 0 ? "in" : "out","</text:p>\n";
237 print $OUT " </text:list-item>\n";
238 print $OUT " </text:list>\n";
239 print $OUT " </text:list-item>\n";
240 print $OUT " </text:list>\n";
241 print $OUT " </draw:text-box>\n";
242 print $OUT " </draw:frame>\n";
243 print $OUT " <presentation:notes draw:style-name=\"dp2\">\n";
244 print $OUT " <draw:page-thumbnail draw:style-name=\"gr1\" draw:layer=\"layout\" svg:width=\"14.851cm\" svg:height=\"11.138cm\" svg:x=\"3.068cm\" svg:y=\"2.257cm\" draw:page-number=\"1\" presentation:class=\"page\"/>\n";
245 print $OUT " <draw:frame presentation:style-name=\"pr3\" draw:layer=\"layout\" svg:width=\"16.79cm\" svg:height=\"13.116cm\" svg:x=\"2.098cm\" svg:y=\"14.109cm\" presentation:class=\"notes\" presentation:placeholder=\"true\">\n";
246 print $OUT " <draw:text-box/>\n";
247 print $OUT " </draw:frame>\n";
248 print $OUT " </presentation:notes>\n";
249 print $OUT " </draw:page>\n";
255 print $OUT qq~ <presentation:settings presentation:full-screen="false"/>
256 </office:presentation>
258 </office:document-content>
265 my $outFile = open_file("META-INF/manifest.xml");
267 print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
268 <!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
269 <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
270 <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
271 <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
306 "diagonalBottomLeft",
392 "twoBladeHorizontal",
403 "counterClockwiseBottomLeft",
404 "clockwiseBottomRight",
405 "counterClockwiseTopRight"]],
425 "oppositeHorizontal",
426 "parallelDiagonalTopLeft",
427 "parallelDiagonalBottomLeft"]],
442 ["topLeftHorizontal",
446 "bottomRightDiagonal",
447 "bottomLeftDiagonal"]],
452 "bottomRightClockwise",
453 "bottomLeftClockwise",
454 "topLeftCounterClockwise",
455 "topRightCounterClockwise",
456 "bottomRightCounterClockwise",
457 "bottomLeftCounterClockwise"]],
459 ["parallelSnakesWipe",
461 "verticalBottomSame",
462 "verticalTopLeftOpposite",
463 "verticalBottomLeftOpposite",
464 "horizontalLeftSame",
465 "horizontalRightSame",
466 "horizontalTopLeftOpposite",
467 "horizontalTopRightOpposite",
468 "diagonalBottomLeftOpposite",
469 "diagonalTopLeftOpposite"]],
476 "fourBoxHorizontal"]],
525 ###############################################################################
526 # Print usage information.
530 print <<END_OF_USAGE;
531 usage: $0 <option>* [<output-file-name>]
533 output-file-name defaults to alltransitions.odp.
535 options: -a Generate _all_ combinations of type, subtype,
537 -h Print this usage information.
541 ###############################################################################
542 # Process the command line.
544 sub process_command_line
556 $global_output_name = "alltransitions.odp";
559 for (my $i=0; $i<=$#ARGV; $i++)
561 if ($ARGV[$i] eq "-a")
565 elsif ($ARGV[$i] =~ /^-/)
567 print "Unknown option $ARGV[$i]\n";
571 elsif ($#ARGV == $i )
573 $global_output_name = $ARGV[$i];
577 print "output to $global_output_name\n";
581 ###############################################################################
583 ###############################################################################
585 $ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
586 $ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
587 # Provide default values for the zip command and it's flags.
588 if ( ! defined $ZipCmd)
590 $ZipCmd = "zip" unless defined $ZipCmd;
591 $ZipFlags = "-r -q" unless defined $ZipFlags;
594 process_command_line();
598 $OUT = open_file( "content.xml" );
603 foreach $transitionRef (@$transitionsRef)
605 $transitionType = @$transitionRef[0];
607 foreach $subtype (@{$transitionRef->[1]})
609 if( $global_gen_all != 0 )
611 writeSlideStyles($slideNum++,
615 writeSlideStyles($slideNum++,
619 writeSlideStyles($slideNum++,
623 writeSlideStyles($slideNum++,
630 writeSlideStyles($slideNum++,
641 foreach $transitionRef (@$transitionsRef)
643 $transitionType = @$transitionRef[0];
645 foreach $subtype (@{$transitionRef->[1]})
647 if( $global_gen_all != 0 )
649 writeSlide($slideNum++,
653 writeSlide($slideNum++,
657 writeSlide($slideNum++,
661 writeSlide($slideNum++,
668 writeSlide($slideNum++,
680 zip_dirtree ($global_output_name);