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