build fix
[LibreOffice.git] / slideshow / source / engine / transitions / parametricpolypolygonfactory.cxx
blob2f190257902da14011aa2c6b65b7e86769bd1236
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 <tools/diagnose_ex.h>
23 #include <com/sun/star/animations/TransitionType.hpp>
24 #include <com/sun/star/animations/TransitionSubType.hpp>
26 #include "parametricpolypolygonfactory.hxx"
27 #include "barwipepolypolygon.hxx"
28 #include "boxwipe.hxx"
29 #include "fourboxwipe.hxx"
30 #include "barndoorwipe.hxx"
31 #include "doublediamondwipe.hxx"
32 #include "veewipe.hxx"
33 #include "iriswipe.hxx"
34 #include "ellipsewipe.hxx"
35 #include "checkerboardwipe.hxx"
36 #include "randomwipe.hxx"
37 #include "waterfallwipe.hxx"
38 #include "clockwipe.hxx"
39 #include "fanwipe.hxx"
40 #include "pinwheelwipe.hxx"
41 #include "snakewipe.hxx"
42 #include "spiralwipe.hxx"
43 #include "sweepwipe.hxx"
44 #include "figurewipe.hxx"
45 #include "zigzagwipe.hxx"
48 using namespace ::com::sun::star;
50 namespace slideshow
52 namespace internal
54 ParametricPolyPolygonSharedPtr
55 ParametricPolyPolygonFactory::createClipPolyPolygon(
56 sal_Int16 nType, sal_Int16 nSubType )
58 using namespace ::com::sun::star::animations::TransitionType;
59 using namespace ::com::sun::star::animations::TransitionSubType;
61 switch (nType)
63 case BARWIPE:
64 return ParametricPolyPolygonSharedPtr(
65 new BarWipePolyPolygon );
66 case BLINDSWIPE:
67 return ParametricPolyPolygonSharedPtr(
68 new BarWipePolyPolygon( 6 ) );
69 case BOXWIPE:
70 return ParametricPolyPolygonSharedPtr(
71 new BoxWipe( nSubType == LEFTCENTER ||
72 nSubType == TOPCENTER ||
73 nSubType == RIGHTCENTER||
74 nSubType == BOTTOMCENTER ) );
75 case FOURBOXWIPE:
76 return ParametricPolyPolygonSharedPtr(
77 new FourBoxWipe( nSubType == CORNERSOUT ) );
78 case BARNDOORWIPE:
79 return ParametricPolyPolygonSharedPtr(
80 new BarnDoorWipe );
81 case DIAGONALWIPE:
82 return ParametricPolyPolygonSharedPtr(
83 new BarWipePolyPolygon );
84 case VEEWIPE:
85 return ParametricPolyPolygonSharedPtr(
86 new VeeWipe );
87 case IRISWIPE:
88 return ParametricPolyPolygonSharedPtr(
89 new IrisWipe );
90 case ELLIPSEWIPE:
91 return ParametricPolyPolygonSharedPtr(
92 new EllipseWipe(nSubType) );
93 case CHECKERBOARDWIPE:
94 return ParametricPolyPolygonSharedPtr(
95 new CheckerBoardWipe );
96 case RANDOMBARWIPE:
97 return ParametricPolyPolygonSharedPtr(
98 new RandomWipe( 128, true /* bars */ ) );
99 case DISSOLVE:
100 return ParametricPolyPolygonSharedPtr(
101 new RandomWipe( 16 * 16, // for now until dxcanvas is faster
102 // 64 * 64 /* elements */,
103 false /* dissolve */ ) );
104 case WATERFALLWIPE:
105 return ParametricPolyPolygonSharedPtr(
106 new WaterfallWipe(
107 128,
108 // flipOnYAxis:
109 nSubType == VERTICALRIGHT ||
110 nSubType == HORIZONTALLEFT ) );
111 case CLOCKWIPE:
112 return ParametricPolyPolygonSharedPtr(
113 new ClockWipe );
114 case FANWIPE:
115 return ParametricPolyPolygonSharedPtr(
116 new FanWipe( // center:
117 nSubType == CENTERTOP ||
118 nSubType == CENTERRIGHT ) );
119 case PINWHEELWIPE: {
120 sal_Int32 blades;
121 switch (nSubType) {
122 case ONEBLADE:
123 blades = 1;
124 break;
125 case THREEBLADE:
126 blades = 3;
127 break;
128 case FOURBLADE:
129 blades = 4;
130 break;
131 case EIGHTBLADE:
132 blades = 8;
133 break;
134 default:
135 blades = 2;
136 break;
138 return ParametricPolyPolygonSharedPtr(
139 new PinWheelWipe( blades ) );
141 case SNAKEWIPE:
142 return ParametricPolyPolygonSharedPtr(
143 new SnakeWipe(
144 // elements:
145 8 * 8,
146 // diagonal:
147 nSubType == TOPLEFTDIAGONAL ||
148 nSubType == TOPRIGHTDIAGONAL ||
149 nSubType == BOTTOMRIGHTDIAGONAL ||
150 nSubType == BOTTOMLEFTDIAGONAL,
151 // flipOnYAxis:
152 nSubType == TOPLEFTVERTICAL ||
153 nSubType == TOPRIGHTDIAGONAL ||
154 nSubType == BOTTOMLEFTDIAGONAL
155 ) );
156 case PARALLELSNAKESWIPE:
157 return ParametricPolyPolygonSharedPtr(
158 new ParallelSnakesWipe(
159 // elements:
160 8 * 8,
161 // diagonal:
162 nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
163 nSubType == DIAGONALTOPLEFTOPPOSITE,
164 // flipOnYAxis:
165 nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
166 nSubType == HORIZONTALTOPLEFTOPPOSITE ||
167 nSubType == DIAGONALTOPLEFTOPPOSITE,
168 // opposite:
169 nSubType == VERTICALTOPLEFTOPPOSITE ||
170 nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
171 nSubType == HORIZONTALTOPLEFTOPPOSITE ||
172 nSubType == HORIZONTALTOPRIGHTOPPOSITE ||
173 nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
174 nSubType == DIAGONALTOPLEFTOPPOSITE
175 ) );
176 case SPIRALWIPE:
177 return ParametricPolyPolygonSharedPtr(
178 new SpiralWipe(
179 // elements:
180 8 * 8,
181 // flipOnYAxis:
182 nSubType == TOPLEFTCOUNTERCLOCKWISE ||
183 nSubType == TOPRIGHTCOUNTERCLOCKWISE ||
184 nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE ||
185 nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ) );
186 case BOXSNAKESWIPE:
187 return ParametricPolyPolygonSharedPtr(
188 new BoxSnakesWipe(
189 // elements:
190 8 * 8,
191 // fourBox:
192 nSubType == FOURBOXVERTICAL ||
193 nSubType == FOURBOXHORIZONTAL ) );
194 case SINGLESWEEPWIPE:
195 return ParametricPolyPolygonSharedPtr(
196 new SweepWipe(
197 // center:
198 nSubType == CLOCKWISETOP ||
199 nSubType == CLOCKWISERIGHT ||
200 nSubType == CLOCKWISEBOTTOM ||
201 nSubType == CLOCKWISELEFT,
202 // single:
203 true,
204 // oppositeVertical:
205 false,
206 // flipOnYAxis:
207 nSubType == COUNTERCLOCKWISEBOTTOMLEFT ||
208 nSubType == COUNTERCLOCKWISETOPRIGHT
209 ) );
210 case DOUBLESWEEPWIPE:
211 return ParametricPolyPolygonSharedPtr(
212 new SweepWipe(
213 // center:
214 nSubType == PARALLELVERTICAL ||
215 nSubType == PARALLELDIAGONAL ||
216 nSubType == OPPOSITEVERTICAL ||
217 nSubType == OPPOSITEHORIZONTAL,
218 // single:
219 false,
220 // oppositeVertical:
221 nSubType == OPPOSITEVERTICAL ||
222 nSubType == OPPOSITEHORIZONTAL,
223 // flipOnYAxis:
224 false ) );
225 case DOUBLEFANWIPE:
226 return ParametricPolyPolygonSharedPtr(
227 new FanWipe(
228 //center:
229 true,
230 // single:
231 false,
232 // fanIn:
233 nSubType == FANINVERTICAL ||
234 nSubType == FANINHORIZONTAL ) );
235 case TRIANGLEWIPE:
236 return ParametricPolyPolygonSharedPtr(
237 FigureWipe::createTriangleWipe() );
238 case ARROWHEADWIPE:
239 return ParametricPolyPolygonSharedPtr(
240 FigureWipe::createArrowHeadWipe() );
241 case PENTAGONWIPE:
242 return ParametricPolyPolygonSharedPtr(
243 FigureWipe::createPentagonWipe() );
244 case HEXAGONWIPE:
245 return ParametricPolyPolygonSharedPtr(
246 FigureWipe::createHexagonWipe() );
247 case STARWIPE: {
248 sal_Int32 points;
249 switch (nSubType) {
250 case FIVEPOINT:
251 points = 5;
252 break;
253 case SIXPOINT:
254 points = 6;
255 break;
256 default:
257 points = 4;
258 break;
260 return ParametricPolyPolygonSharedPtr(
261 FigureWipe::createStarWipe(points) );
263 case MISCDIAGONALWIPE: {
264 switch (nSubType) {
265 case DOUBLEBARNDOOR:
266 return ParametricPolyPolygonSharedPtr(
267 new BarnDoorWipe( true /* doubled */ ) );
268 case DOUBLEDIAMOND:
269 return ParametricPolyPolygonSharedPtr(
270 new DoubleDiamondWipe );
272 break;
274 case ZIGZAGWIPE:
275 return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) );
276 case BARNZIGZAGWIPE:
277 return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) );
279 case BOWTIEWIPE:
280 case BARNVEEWIPE:
281 case EYEWIPE:
282 case ROUNDRECTWIPE:
283 case MISCSHAPEWIPE:
284 case SALOONDOORWIPE:
285 case WINDSHIELDWIPE:
286 // for now, map to barwipe transition
287 return ParametricPolyPolygonSharedPtr(
288 new BarWipePolyPolygon );
290 default:
291 case PUSHWIPE:
292 case SLIDEWIPE:
293 case FADE:
294 ENSURE_OR_THROW( false,
295 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
298 return ParametricPolyPolygonSharedPtr();
303 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */