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