2 eval 'exec perl -wS $0 ${1+"$@"}'
6 # This file is part of the LibreOffice project.
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # This file incorporates work covered by the following license notice:
14 # Licensed to the Apache Software Foundation (ASF) under one or more
15 # contributor license agreements. See the NOTICE file distributed
16 # with this work for additional information regarding copyright
17 # ownership. The ASF licenses this file to you under the Apache
18 # License, Version 2.0 (the "License"); you may not use this file
19 # except in compliance with the License. You may obtain a copy of
20 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
26 use File
::Spec
::Functions
;
33 # all the XML package generation is a blatant rip from AF's
37 ###############################################################################
38 # Open a file with the given name.
39 # First it is checked if the temporary directory, in which all files for
40 # the document are gathered, is already present and create it if it is not.
41 # Then create the path to the file inside the temporary directory.
42 # Finally open the file and return a file handle to it.
46 my $filename = pop @_;
48 # Create base directory of temporary directory tree if not alreay
52 $TempDir = File
::Temp
::tempdir
(CLEANUP
=> 1);
55 # Create the path to the file.
56 my $fullname = File
::Spec
->catfile ($TempDir, $filename);
57 my ($volume,$directories,$file) = File
::Spec
->splitpath ($fullname);
58 mkpath
(File
::Spec
->catpath ($volume,$directories,""));
60 # Open the file and return a file handle to it.
61 return new IO
::File
($fullname, "w");
65 ###############################################################################
66 # Zip the files in the directory tree into the given file.
70 my $filename = pop @_;
73 my $zip_name = $filename;
75 # We are about to change the directory.
76 # Therefore create an absolute pathname for the zip archive.
78 # First transfer the drive from $cwd to $zip_name. This is a
79 # workaround for a bug in file_name_is_absolute which thinks
80 # the path \bla is an absolute path under DOS.
81 my ($volume,$directories,$file) = File
::Spec
->splitpath ($zip_name);
82 my ($volume_cwd,$directories_cwd,$file_cwd) = File
::Spec
->splitpath ($cwd);
83 $volume = $volume_cwd if ($volume eq "");
84 $zip_name = File
::Spec
->catpath ($volume,$directories,$file);
86 # Add the current working directory to a relative path.
87 if ( ! file_name_is_absolute
($zip_name))
89 $zip_name = File
::Spec
->catfile ($cwd, $zip_name);
91 # Try everything to clean up the name.
92 $zip_name = File
::Spec
->rel2abs ($filename);
93 $zip_name = File
::Spec
->canonpath ($zip_name);
95 # Remove .. directories from the middle of the path.
96 while ($zip_name =~ /\/[^\
/][^\.\/][^\
/]*\/\
.\
.\
//)
98 $zip_name = $` . "/" . $';
102 # Just in case the zip program gets confused by an existing file with the
103 # same name as the one to be written that file is removed first.
106 if (unlink ($filename) == 0)
108 print "Existing file $filename could not be deleted.\n";
109 print "Please close the application that uses it, then try again.\n";
114 # Finally create the zip file. First change into the temporary directory
115 # so that the resulting zip file contains only paths relative to it.
116 print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
118 system ("$ZipCmd $ZipFlags $zip_name *");
126 print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
128 <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">
130 <office:automatic-styles>
138 my $direction = pop @_;
139 my $transitionSubType = pop @_;
140 my $transitionType = pop @_;
141 my $slideNum = pop @_;
143 print $OUT " <style:style style:name=\"dp",$slideNum,"\" style:family=\"drawing-page\">\n";
144 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";
145 print $OUT " </style:style>\n";
148 sub writeIntermediate
150 print $OUT qq~ <style:style style:name="gr1" style:family="graphic">
151 <style:graphic-properties style:protect="size"/>
153 <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
154 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
156 <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
157 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
159 <style:style style:name="P1" style:family="paragraph">
160 <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
162 <style:style style:name="P2" style:family="paragraph">
163 <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
165 <text:list-style style:name="L1">
166 <text:list-level-style-bullet text:level="1" text:bullet-char="●">
167 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
168 </text:list-level-style-bullet>
169 <text:list-level-style-bullet text:level="2" text:bullet-char="●">
170 <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
171 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
172 </text:list-level-style-bullet>
173 <text:list-level-style-bullet text:level="3" text:bullet-char="●">
174 <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
175 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
176 </text:list-level-style-bullet>
177 <text:list-level-style-bullet text:level="4" text:bullet-char="●">
178 <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
179 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
180 </text:list-level-style-bullet>
181 <text:list-level-style-bullet text:level="5" text:bullet-char="●">
182 <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
183 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
184 </text:list-level-style-bullet>
185 <text:list-level-style-bullet text:level="6" text:bullet-char="●">
186 <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
187 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
188 </text:list-level-style-bullet>
189 <text:list-level-style-bullet text:level="7" text:bullet-char="●">
190 <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
191 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
192 </text:list-level-style-bullet>
193 <text:list-level-style-bullet text:level="8" text:bullet-char="●">
194 <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
195 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
196 </text:list-level-style-bullet>
197 <text:list-level-style-bullet text:level="9" text:bullet-char="●">
198 <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
199 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
200 </text:list-level-style-bullet>
202 </office:automatic-styles>
204 <office:presentation>
212 my $direction = pop @_;
213 my $transitionSubtype = pop @_;
214 my $transitionType = pop @_;
215 my $slideNum = pop @_;
217 print $OUT " <draw:page draw:name=\"page",$slideNum,"\" draw:style-name=\"dp",$slideNum,"\" draw:master-page-name=\"Default\" presentation:presentation-page-layout-name=\"AL1T19\">";
219 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";
220 print $OUT " <draw:text-box>\n";
221 print $OUT " <text:p text:style-name=\"P1\">Transition “",$slideNum-1,"”</text:p>\n";
222 print $OUT " </draw:text-box>\n";
223 print $OUT " </draw:frame>\n";
224 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";
225 print $OUT " <draw:text-box>\n";
226 print $OUT " <text:list text:style-name=\"L2\">\n";
227 print $OUT " <text:list-item>\n";
228 print $OUT " <text:p text:style-name=\"P2\">Transition: ",$transitionType,"</text:p>\n";
229 print $OUT " </text:list-item>\n";
230 print $OUT " </text:list>\n";
231 print $OUT " <text:list text:style-name=\"L2\">\n";
232 print $OUT " <text:list-item>\n";
233 print $OUT " <text:list>\n";
234 print $OUT " <text:list-item>\n";
235 print $OUT " <text:p text:style-name=\"P3\">Subtype: ",$transitionSubtype,"</text:p>\n";
236 print $OUT " </text:list-item>\n";
237 print $OUT " </text:list>\n";
238 print $OUT " </text:list-item>\n";
239 print $OUT " </text:list>\n";
240 print $OUT " <text:list text:style-name=\"L2\">\n";
241 print $OUT " <text:list-item>\n";
242 print $OUT " <text:list>\n";
243 print $OUT " <text:list-item>\n";
244 print $OUT " <text:p text:style-name=\"P3\">Direction: ",$direction == 0 ? "forward" : "reverse","</text:p>\n";
245 print $OUT " </text:list-item>\n";
246 print $OUT " </text:list>\n";
247 print $OUT " </text:list-item>\n";
248 print $OUT " </text:list>\n";
249 print $OUT " <text:list text:style-name=\"L2\">\n";
250 print $OUT " <text:list-item>\n";
251 print $OUT " <text:list>\n";
252 print $OUT " <text:list-item>\n";
253 print $OUT " <text:p text:style-name=\"P3\">Mode: ",$mode == 0 ? "in" : "out","</text:p>\n";
254 print $OUT " </text:list-item>\n";
255 print $OUT " </text:list>\n";
256 print $OUT " </text:list-item>\n";
257 print $OUT " </text:list>\n";
258 print $OUT " </draw:text-box>\n";
259 print $OUT " </draw:frame>\n";
260 print $OUT " <presentation:notes draw:style-name=\"dp2\">\n";
261 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";
262 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";
263 print $OUT " <draw:text-box/>\n";
264 print $OUT " </draw:frame>\n";
265 print $OUT " </presentation:notes>\n";
266 print $OUT " </draw:page>\n";
272 print $OUT qq~ <presentation:settings presentation:full-screen="false"/>
273 </office:presentation>
275 </office:document-content>
282 my $outFile = open_file("META-INF/manifest.xml");
284 print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
285 <!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
286 <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
287 <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
288 <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
323 "diagonalBottomLeft",
409 "twoBladeHorizontal",
420 "counterClockwiseBottomLeft",
421 "clockwiseBottomRight",
422 "counterClockwiseTopRight"]],
442 "oppositeHorizontal",
443 "parallelDiagonalTopLeft",
444 "parallelDiagonalBottomLeft"]],
459 ["topLeftHorizontal",
463 "bottomRightDiagonal",
464 "bottomLeftDiagonal"]],
469 "bottomRightClockwise",
470 "bottomLeftClockwise",
471 "topLeftCounterClockwise",
472 "topRightCounterClockwise",
473 "bottomRightCounterClockwise",
474 "bottomLeftCounterClockwise"]],
476 ["parallelSnakesWipe",
478 "verticalBottomSame",
479 "verticalTopLeftOpposite",
480 "verticalBottomLeftOpposite",
481 "horizontalLeftSame",
482 "horizontalRightSame",
483 "horizontalTopLeftOpposite",
484 "horizontalTopRightOpposite",
485 "diagonalBottomLeftOpposite",
486 "diagonalTopLeftOpposite"]],
493 "fourBoxHorizontal"]],
542 ###############################################################################
543 # Print usage information.
547 print <<END_OF_USAGE;
548 usage: $0 <option>* [<output-file-name>]
550 output-file-name defaults to alltransitions.odp.
552 options: -a Generate _all_ combinations of type, subtype,
554 -h Print this usage information.
558 ###############################################################################
559 # Process the command line.
561 sub process_command_line
573 $global_output_name = "alltransitions.odp";
576 for (my $i=0; $i<=$#ARGV; $i++)
578 if ($ARGV[$i] eq "-a")
582 elsif ($ARGV[$i] =~ /^-/)
584 print "Unknown option $ARGV[$i]\n";
588 elsif ($#ARGV == $i )
590 $global_output_name = $ARGV[$i];
594 print "output to $global_output_name\n";
598 ###############################################################################
600 ###############################################################################
602 $ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
603 $ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
604 # Provide default values for the zip command and it's flags.
605 if ( ! defined $ZipCmd)
607 $ZipCmd = "zip" unless defined $ZipCmd;
608 $ZipFlags = "-r -q" unless defined $ZipFlags;
611 process_command_line();
615 $OUT = open_file( "content.xml" );
620 foreach $transitionRef (@$transitionsRef)
622 $transitionType = @$transitionRef[0];
624 foreach $subtype (@{$transitionRef->[1]})
626 if( $global_gen_all != 0 )
628 writeSlideStyles($slideNum++,
632 writeSlideStyles($slideNum++,
636 writeSlideStyles($slideNum++,
640 writeSlideStyles($slideNum++,
647 writeSlideStyles($slideNum++,
658 foreach $transitionRef (@$transitionsRef)
660 $transitionType = @$transitionRef[0];
662 foreach $subtype (@{$transitionRef->[1]})
664 if( $global_gen_all != 0 )
666 writeSlide($slideNum++,
670 writeSlide($slideNum++,
674 writeSlide($slideNum++,
678 writeSlide($slideNum++,
685 writeSlide($slideNum++,
697 zip_dirtree ($global_output_name);