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
;
31 my $FirstTransitionIndex = 0;
32 my $LastTransitionIndex = -1;
35 # all the XML package generation is a blatant rip from AF's
39 ###############################################################################
40 # Open a file with the given name.
41 # First it is checked if the temporary directory, in which all files for
42 # the document are gathered, is already present and create it if it is not.
43 # Then create the path to the file inside the temporary directory.
44 # Finally open the file and return a file handle to it.
48 my $filename = pop @_;
50 # Create base directory of temporary directory tree if not already
54 $TempDir = File
::Temp
::tempdir
(CLEANUP
=> 1);
57 # Create the path to the file.
58 my $fullname = File
::Spec
->catfile ($TempDir, $filename);
59 my ($volume,$directories,$file) = File
::Spec
->splitpath ($fullname);
60 mkpath
(File
::Spec
->catpath ($volume,$directories,""));
62 # Open the file and return a file handle to it.
63 return new IO
::File
($fullname, "w");
67 ###############################################################################
68 # Zip the files in the directory tree into the given file.
72 my $filename = pop @_;
75 my $zip_name = $filename;
77 # We are about to change the directory.
78 # Therefore create an absolute pathname for the zip archive.
80 # First transfer the drive from $cwd to $zip_name. This is a
81 # workaround for a bug in file_name_is_absolute which thinks
82 # the path \bla is an absolute path under DOS.
83 my ($volume,$directories,$file) = File
::Spec
->splitpath ($zip_name);
84 my ($volume_cwd,$directories_cwd,$file_cwd) = File
::Spec
->splitpath ($cwd);
85 $volume = $volume_cwd if ($volume eq "");
86 $zip_name = File
::Spec
->catpath ($volume,$directories,$file);
88 # Add the current working directory to a relative path.
89 if ( ! file_name_is_absolute
($zip_name))
91 $zip_name = File
::Spec
->catfile ($cwd, $zip_name);
93 # Try everything to clean up the name.
94 $zip_name = File
::Spec
->rel2abs ($filename);
95 $zip_name = File
::Spec
->canonpath ($zip_name);
97 # Remove .. directories from the middle of the path.
98 while ($zip_name =~ /\/[^\
/][^\.\/][^\
/]*\/\
.\
.\
//)
100 $zip_name = $` . "/" . $'; # $'
104 # Just in case the zip program gets confused by an existing file with the
105 # same name as the one to be written that file is removed first.
108 if (unlink ($filename) == 0)
110 print "Existing file $filename could not be deleted.\n";
111 print "Please close the application that uses it, then try again.\n";
116 # Finally create the zip file. First change into the temporary directory
117 # so that the resulting zip file contains only paths relative to it.
118 print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
120 system ("$ZipCmd $ZipFlags $zip_name *");
128 print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
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">
132 <office:automatic-styles>
140 my $direction = pop @_;
141 my $transitionSubType = pop @_;
142 my $transitionType = pop @_;
143 my $slideNum = pop @_;
145 return if $slideNum<$FirstTransitionIndex || ($LastTransitionIndex>=0 && $slideNum>$LastTransitionIndex);
147 print $OUT " <style:style style:name=\"dp",$slideNum,"\" style:family=\"drawing-page\">\n";
148 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";
149 print $OUT " </style:style>\n";
152 sub writeIntermediate
154 print $OUT qq~ <style:style style:name="gr1" style:family="graphic">
155 <style:graphic-properties style:protect="size"/>
157 <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
158 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
160 <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
161 <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
163 <style:style style:name="P1" style:family="paragraph">
164 <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
166 <style:style style:name="P2" style:family="paragraph">
167 <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
169 <text:list-style style:name="L1">
170 <text:list-level-style-bullet text:level="1" text:bullet-char="●">
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="2" text:bullet-char="●">
174 <style:list-level-properties text:space-before="0.6cm" 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="3" text:bullet-char="●">
178 <style:list-level-properties text:space-before="1.2cm" 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="4" text:bullet-char="●">
182 <style:list-level-properties text:space-before="1.8cm" 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="5" text:bullet-char="●">
186 <style:list-level-properties text:space-before="2.4cm" 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="6" text:bullet-char="●">
190 <style:list-level-properties text:space-before="3cm" 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="7" text:bullet-char="●">
194 <style:list-level-properties text:space-before="3.6cm" 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="8" text:bullet-char="●">
198 <style:list-level-properties text:space-before="4.2cm" 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>
201 <text:list-level-style-bullet text:level="9" text:bullet-char="●">
202 <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
203 <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
204 </text:list-level-style-bullet>
206 </office:automatic-styles>
208 <office:presentation>
216 my $direction = pop @_;
217 my $transitionSubtype = pop @_;
218 my $transitionType = pop @_;
219 my $slideNum = pop @_;
221 return if $slideNum<$FirstTransitionIndex || ($LastTransitionIndex>=0 && $slideNum>$LastTransitionIndex);
223 print $OUT " <draw:page draw:name=\"page",$slideNum,"\" draw:style-name=\"dp",$slideNum,"\" draw:master-page-name=\"Default\" presentation:presentation-page-layout-name=\"AL1T19\">";
225 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";
226 print $OUT " <draw:text-box>\n";
227 print $OUT " <text:p text:style-name=\"P1\">Transition “",$slideNum-1,"”</text:p>\n";
228 print $OUT " </draw:text-box>\n";
229 print $OUT " </draw:frame>\n";
230 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";
231 print $OUT " <draw:text-box>\n";
232 print $OUT " <text:list text:style-name=\"L2\">\n";
233 print $OUT " <text:list-item>\n";
234 print $OUT " <text:p text:style-name=\"P2\">Transition: ",$transitionType,"</text:p>\n";
235 print $OUT " </text:list-item>\n";
236 print $OUT " </text:list>\n";
237 print $OUT " <text:list text:style-name=\"L2\">\n";
238 print $OUT " <text:list-item>\n";
239 print $OUT " <text:list>\n";
240 print $OUT " <text:list-item>\n";
241 print $OUT " <text:p text:style-name=\"P3\">Subtype: ",$transitionSubtype,"</text:p>\n";
242 print $OUT " </text:list-item>\n";
243 print $OUT " </text:list>\n";
244 print $OUT " </text:list-item>\n";
245 print $OUT " </text:list>\n";
246 print $OUT " <text:list text:style-name=\"L2\">\n";
247 print $OUT " <text:list-item>\n";
248 print $OUT " <text:list>\n";
249 print $OUT " <text:list-item>\n";
250 print $OUT " <text:p text:style-name=\"P3\">Direction: ",$direction == 0 ? "forward" : "reverse","</text:p>\n";
251 print $OUT " </text:list-item>\n";
252 print $OUT " </text:list>\n";
253 print $OUT " </text:list-item>\n";
254 print $OUT " </text:list>\n";
255 print $OUT " <text:list text:style-name=\"L2\">\n";
256 print $OUT " <text:list-item>\n";
257 print $OUT " <text:list>\n";
258 print $OUT " <text:list-item>\n";
259 print $OUT " <text:p text:style-name=\"P3\">Mode: ",$mode == 0 ? "in" : "out","</text:p>\n";
260 print $OUT " </text:list-item>\n";
261 print $OUT " </text:list>\n";
262 print $OUT " </text:list-item>\n";
263 print $OUT " </text:list>\n";
264 print $OUT " </draw:text-box>\n";
265 print $OUT " </draw:frame>\n";
266 print $OUT " <presentation:notes draw:style-name=\"dp2\">\n";
267 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";
268 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";
269 print $OUT " <draw:text-box/>\n";
270 print $OUT " </draw:frame>\n";
271 print $OUT " </presentation:notes>\n";
272 print $OUT " </draw:page>\n";
278 print $OUT qq~ <presentation:settings presentation:full-screen="false"/>
279 </office:presentation>
281 </office:document-content>
288 my $outFile = open_file("META-INF/manifest.xml");
290 print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
291 <!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
292 <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
293 <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
294 <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
329 "diagonalBottomLeft",
415 "twoBladeHorizontal",
426 "counterClockwiseBottomLeft",
427 "clockwiseBottomRight",
428 "counterClockwiseTopRight"]],
448 "oppositeHorizontal",
449 "parallelDiagonalTopLeft",
450 "parallelDiagonalBottomLeft"]],
465 ["topLeftHorizontal",
469 "bottomRightDiagonal",
470 "bottomLeftDiagonal"]],
475 "bottomRightClockwise",
476 "bottomLeftClockwise",
477 "topLeftCounterClockwise",
478 "topRightCounterClockwise",
479 "bottomRightCounterClockwise",
480 "bottomLeftCounterClockwise"]],
482 ["parallelSnakesWipe",
484 "verticalBottomSame",
485 "verticalTopLeftOpposite",
486 "verticalBottomLeftOpposite",
487 "horizontalLeftSame",
488 "horizontalRightSame",
489 "horizontalTopLeftOpposite",
490 "horizontalTopRightOpposite",
491 "diagonalBottomLeftOpposite",
492 "diagonalTopLeftOpposite"]],
499 "fourBoxHorizontal"]],
548 ###############################################################################
549 # Print usage information.
553 print <<END_OF_USAGE;
554 usage: $0 <option>* [<output-file-name>]
556 output-file-name defaults to alltransitions.odp.
558 options: -a Generate _all_ combinations of type, subtype,
560 -h Print this usage information.
561 -f First transition to include, defaults to 0
562 -l Last transition to include
566 ###############################################################################
567 # Process the command line.
569 sub process_command_line
581 $global_output_name = "alltransitions.odp";
584 for (my $i=0; $i<=$#ARGV; $i++)
586 if ($ARGV[$i] eq "-a")
590 elsif ($ARGV[$i] eq "-f")
592 $FirstTransitionIndex = $ARGV[++$i];
594 elsif ($ARGV[$i] eq "-l")
596 $LastTransitionIndex = $ARGV[++$i];
598 elsif ($ARGV[$i] =~ /^-/)
600 print "Unknown option $ARGV[$i]\n";
604 elsif ($#ARGV == $i )
606 $global_output_name = $ARGV[$i];
610 print "output to $global_output_name\n";
614 ###############################################################################
616 ###############################################################################
618 $ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
619 $ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
620 # Provide default values for the zip command and it's flags.
621 if ( ! defined $ZipCmd)
623 $ZipCmd = "zip" unless defined $ZipCmd;
624 $ZipFlags = "-r -q" unless defined $ZipFlags;
627 process_command_line();
631 $OUT = open_file( "content.xml" );
636 foreach $transitionRef (@$transitionsRef)
638 $transitionType = @$transitionRef[0];
640 foreach $subtype (@{$transitionRef->[1]})
642 if( $global_gen_all != 0 )
644 writeSlideStyles($slideNum++,
648 writeSlideStyles($slideNum++,
652 writeSlideStyles($slideNum++,
656 writeSlideStyles($slideNum++,
663 writeSlideStyles($slideNum++,
674 foreach $transitionRef (@$transitionsRef)
676 $transitionType = @$transitionRef[0];
678 foreach $subtype (@{$transitionRef->[1]})
680 if( $global_gen_all != 0 )
682 writeSlide($slideNum++,
686 writeSlide($slideNum++,
690 writeSlide($slideNum++,
694 writeSlide($slideNum++,
701 writeSlide($slideNum++,
713 zip_dirtree ($global_output_name);