1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_slideshow.hxx" 26 27 #include <canvas/debug.hxx> 28 #include <tools/diagnose_ex.h> 29 30 #include <com/sun/star/animations/TransitionType.hpp> 31 #include <com/sun/star/animations/TransitionSubType.hpp> 32 33 #include "parametricpolypolygonfactory.hxx" 34 #include "barwipepolypolygon.hxx" 35 #include "boxwipe.hxx" 36 #include "fourboxwipe.hxx" 37 #include "barndoorwipe.hxx" 38 #include "doublediamondwipe.hxx" 39 #include "veewipe.hxx" 40 #include "iriswipe.hxx" 41 #include "ellipsewipe.hxx" 42 #include "checkerboardwipe.hxx" 43 #include "randomwipe.hxx" 44 #include "waterfallwipe.hxx" 45 #include "clockwipe.hxx" 46 #include "fanwipe.hxx" 47 #include "pinwheelwipe.hxx" 48 #include "snakewipe.hxx" 49 #include "spiralwipe.hxx" 50 #include "sweepwipe.hxx" 51 #include "figurewipe.hxx" 52 #include "zigzagwipe.hxx" 53 54 55 using namespace ::com::sun::star; 56 57 namespace slideshow 58 { 59 namespace internal 60 { 61 ParametricPolyPolygonSharedPtr createClipPolyPolygon(sal_Int16 nType,sal_Int16 nSubType)62 ParametricPolyPolygonFactory::createClipPolyPolygon( 63 sal_Int16 nType, sal_Int16 nSubType ) 64 { 65 using namespace ::com::sun::star::animations::TransitionType; 66 using namespace ::com::sun::star::animations::TransitionSubType; 67 68 switch (nType) 69 { 70 case BARWIPE: 71 return ParametricPolyPolygonSharedPtr( 72 new BarWipePolyPolygon ); 73 case BLINDSWIPE: 74 return ParametricPolyPolygonSharedPtr( 75 new BarWipePolyPolygon( 6 ) ); 76 case BOXWIPE: 77 return ParametricPolyPolygonSharedPtr( 78 new BoxWipe( nSubType == LEFTCENTER || 79 nSubType == TOPCENTER || 80 nSubType == RIGHTCENTER|| 81 nSubType == BOTTOMCENTER ) ); 82 case FOURBOXWIPE: 83 return ParametricPolyPolygonSharedPtr( 84 new FourBoxWipe( nSubType == CORNERSOUT ) ); 85 case BARNDOORWIPE: 86 return ParametricPolyPolygonSharedPtr( 87 new BarnDoorWipe ); 88 case DIAGONALWIPE: 89 return ParametricPolyPolygonSharedPtr( 90 new BarWipePolyPolygon ); 91 case VEEWIPE: 92 return ParametricPolyPolygonSharedPtr( 93 new VeeWipe ); 94 case IRISWIPE: 95 return ParametricPolyPolygonSharedPtr( 96 new IrisWipe ); 97 case ELLIPSEWIPE: 98 return ParametricPolyPolygonSharedPtr( 99 new EllipseWipe(nSubType) ); 100 case CHECKERBOARDWIPE: 101 return ParametricPolyPolygonSharedPtr( 102 new CheckerBoardWipe ); 103 case RANDOMBARWIPE: 104 return ParametricPolyPolygonSharedPtr( 105 new RandomWipe( 128, true /* bars */ ) ); 106 case DISSOLVE: 107 return ParametricPolyPolygonSharedPtr( 108 new RandomWipe( 16 * 16, // for now until dxcanvas is faster 109 // 64 * 64 /* elements */, 110 false /* dissolve */ ) ); 111 case WATERFALLWIPE: 112 return ParametricPolyPolygonSharedPtr( 113 new WaterfallWipe( 114 128, 115 // flipOnYAxis: 116 nSubType == VERTICALRIGHT || 117 nSubType == HORIZONTALLEFT ) ); 118 case CLOCKWIPE: 119 return ParametricPolyPolygonSharedPtr( 120 new ClockWipe ); 121 case FANWIPE: 122 return ParametricPolyPolygonSharedPtr( 123 new FanWipe( // center: 124 nSubType == CENTERTOP || 125 nSubType == CENTERRIGHT ) ); 126 case PINWHEELWIPE: { 127 sal_Int32 blades; 128 switch (nSubType) { 129 case ONEBLADE: 130 blades = 1; 131 break; 132 case THREEBLADE: 133 blades = 3; 134 break; 135 case FOURBLADE: 136 blades = 4; 137 break; 138 case EIGHTBLADE: 139 blades = 8; 140 break; 141 default: 142 blades = 2; 143 break; 144 } 145 return ParametricPolyPolygonSharedPtr( 146 new PinWheelWipe( blades ) ); 147 } 148 case SNAKEWIPE: 149 return ParametricPolyPolygonSharedPtr( 150 new SnakeWipe( 151 // elements: 152 8 * 8, 153 // diagonal: 154 nSubType == TOPLEFTDIAGONAL || 155 nSubType == TOPRIGHTDIAGONAL || 156 nSubType == BOTTOMRIGHTDIAGONAL || 157 nSubType == BOTTOMLEFTDIAGONAL, 158 // flipOnYAxis: 159 nSubType == TOPLEFTVERTICAL || 160 nSubType == TOPRIGHTDIAGONAL || 161 nSubType == BOTTOMLEFTDIAGONAL 162 ) ); 163 case PARALLELSNAKESWIPE: 164 return ParametricPolyPolygonSharedPtr( 165 new ParallelSnakesWipe( 166 // elements: 167 8 * 8, 168 // diagonal: 169 nSubType == DIAGONALBOTTOMLEFTOPPOSITE || 170 nSubType == DIAGONALTOPLEFTOPPOSITE, 171 // flipOnYAxis: 172 nSubType == VERTICALBOTTOMLEFTOPPOSITE || 173 nSubType == HORIZONTALTOPLEFTOPPOSITE || 174 nSubType == DIAGONALTOPLEFTOPPOSITE, 175 // opposite: 176 nSubType == VERTICALTOPLEFTOPPOSITE || 177 nSubType == VERTICALBOTTOMLEFTOPPOSITE || 178 nSubType == HORIZONTALTOPLEFTOPPOSITE || 179 nSubType == HORIZONTALTOPRIGHTOPPOSITE || 180 nSubType == DIAGONALBOTTOMLEFTOPPOSITE || 181 nSubType == DIAGONALTOPLEFTOPPOSITE 182 ) ); 183 case SPIRALWIPE: 184 return ParametricPolyPolygonSharedPtr( 185 new SpiralWipe( 186 // elements: 187 8 * 8, 188 // flipOnYAxis: 189 nSubType == TOPLEFTCOUNTERCLOCKWISE || 190 nSubType == TOPRIGHTCOUNTERCLOCKWISE || 191 nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE || 192 nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ) ); 193 case BOXSNAKESWIPE: 194 return ParametricPolyPolygonSharedPtr( 195 new BoxSnakesWipe( 196 // elements: 197 8 * 8, 198 // fourBox: 199 nSubType == FOURBOXVERTICAL || 200 nSubType == FOURBOXHORIZONTAL ) ); 201 case SINGLESWEEPWIPE: 202 return ParametricPolyPolygonSharedPtr( 203 new SweepWipe( 204 // center: 205 nSubType == CLOCKWISETOP || 206 nSubType == CLOCKWISERIGHT || 207 nSubType == CLOCKWISEBOTTOM || 208 nSubType == CLOCKWISELEFT, 209 // single: 210 true, 211 // oppositeVertical: 212 false, 213 // flipOnYAxis: 214 nSubType == COUNTERCLOCKWISEBOTTOMLEFT || 215 nSubType == COUNTERCLOCKWISETOPRIGHT 216 ) ); 217 case DOUBLESWEEPWIPE: 218 return ParametricPolyPolygonSharedPtr( 219 new SweepWipe( 220 // center: 221 nSubType == PARALLELVERTICAL || 222 nSubType == PARALLELDIAGONAL || 223 nSubType == OPPOSITEVERTICAL || 224 nSubType == OPPOSITEHORIZONTAL, 225 // single: 226 false, 227 // oppositeVertical: 228 nSubType == OPPOSITEVERTICAL || 229 nSubType == OPPOSITEHORIZONTAL, 230 // flipOnYAxis: 231 false ) ); 232 case DOUBLEFANWIPE: 233 return ParametricPolyPolygonSharedPtr( 234 new FanWipe( 235 //center: 236 true, 237 // single: 238 false, 239 // fanIn: 240 nSubType == FANINVERTICAL || 241 nSubType == FANINHORIZONTAL ) ); 242 case TRIANGLEWIPE: 243 return ParametricPolyPolygonSharedPtr( 244 FigureWipe::createTriangleWipe() ); 245 case ARROWHEADWIPE: 246 return ParametricPolyPolygonSharedPtr( 247 FigureWipe::createArrowHeadWipe() ); 248 case PENTAGONWIPE: 249 return ParametricPolyPolygonSharedPtr( 250 FigureWipe::createPentagonWipe() ); 251 case HEXAGONWIPE: 252 return ParametricPolyPolygonSharedPtr( 253 FigureWipe::createHexagonWipe() ); 254 case STARWIPE: { 255 sal_Int32 points; 256 switch (nSubType) { 257 case FIVEPOINT: 258 points = 5; 259 break; 260 case SIXPOINT: 261 points = 6; 262 break; 263 default: 264 points = 4; 265 break; 266 } 267 return ParametricPolyPolygonSharedPtr( 268 FigureWipe::createStarWipe(points) ); 269 } 270 case MISCDIAGONALWIPE: { 271 switch (nSubType) { 272 case DOUBLEBARNDOOR: 273 return ParametricPolyPolygonSharedPtr( 274 new BarnDoorWipe( true /* doubled */ ) ); 275 case DOUBLEDIAMOND: 276 return ParametricPolyPolygonSharedPtr( 277 new DoubleDiamondWipe ); 278 } 279 break; 280 } 281 case ZIGZAGWIPE: 282 return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) ); 283 case BARNZIGZAGWIPE: 284 return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) ); 285 286 case BOWTIEWIPE: 287 case BARNVEEWIPE: 288 case EYEWIPE: 289 case ROUNDRECTWIPE: 290 case MISCSHAPEWIPE: 291 case SALOONDOORWIPE: 292 case WINDSHIELDWIPE: 293 // for now, map to barwipe transition 294 return ParametricPolyPolygonSharedPtr( 295 new BarWipePolyPolygon ); 296 297 default: 298 case PUSHWIPE: 299 case SLIDEWIPE: 300 case FADE: 301 ENSURE_OR_THROW( false, 302 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" ); 303 } 304 305 return ParametricPolyPolygonSharedPtr(); 306 } 307 } 308 } 309