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