Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include <canvas/debug.hxx>
22 : #include <tools/diagnose_ex.h>
23 :
24 : #include <com/sun/star/animations/TransitionType.hpp>
25 : #include <com/sun/star/animations/TransitionSubType.hpp>
26 :
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"
47 :
48 :
49 : using namespace ::com::sun::star;
50 :
51 : namespace slideshow
52 : {
53 : namespace internal
54 : {
55 : ParametricPolyPolygonSharedPtr
56 0 : ParametricPolyPolygonFactory::createClipPolyPolygon(
57 : sal_Int16 nType, sal_Int16 nSubType )
58 : {
59 : using namespace ::com::sun::star::animations::TransitionType;
60 : using namespace ::com::sun::star::animations::TransitionSubType;
61 :
62 0 : switch (nType)
63 : {
64 : case BARWIPE:
65 : return ParametricPolyPolygonSharedPtr(
66 0 : new BarWipePolyPolygon );
67 : case BLINDSWIPE:
68 : return ParametricPolyPolygonSharedPtr(
69 0 : new BarWipePolyPolygon( 6 ) );
70 : case BOXWIPE:
71 : return ParametricPolyPolygonSharedPtr(
72 0 : new BoxWipe( nSubType == LEFTCENTER ||
73 0 : nSubType == TOPCENTER ||
74 0 : nSubType == RIGHTCENTER||
75 0 : nSubType == BOTTOMCENTER ) );
76 : case FOURBOXWIPE:
77 : return ParametricPolyPolygonSharedPtr(
78 0 : new FourBoxWipe( nSubType == CORNERSOUT ) );
79 : case BARNDOORWIPE:
80 : return ParametricPolyPolygonSharedPtr(
81 0 : new BarnDoorWipe );
82 : case DIAGONALWIPE:
83 : return ParametricPolyPolygonSharedPtr(
84 0 : new BarWipePolyPolygon );
85 : case VEEWIPE:
86 : return ParametricPolyPolygonSharedPtr(
87 0 : new VeeWipe );
88 : case IRISWIPE:
89 : return ParametricPolyPolygonSharedPtr(
90 0 : new IrisWipe );
91 : case ELLIPSEWIPE:
92 : return ParametricPolyPolygonSharedPtr(
93 0 : new EllipseWipe(nSubType) );
94 : case CHECKERBOARDWIPE:
95 : return ParametricPolyPolygonSharedPtr(
96 0 : new CheckerBoardWipe );
97 : case RANDOMBARWIPE:
98 : return ParametricPolyPolygonSharedPtr(
99 0 : 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 0 : false /* dissolve */ ) );
105 : case WATERFALLWIPE:
106 : return ParametricPolyPolygonSharedPtr(
107 : new WaterfallWipe(
108 : 128,
109 : // flipOnYAxis:
110 0 : nSubType == VERTICALRIGHT ||
111 0 : nSubType == HORIZONTALLEFT ) );
112 : case CLOCKWIPE:
113 : return ParametricPolyPolygonSharedPtr(
114 0 : new ClockWipe );
115 : case FANWIPE:
116 : return ParametricPolyPolygonSharedPtr(
117 : new FanWipe( // center:
118 0 : nSubType == CENTERTOP ||
119 0 : nSubType == CENTERRIGHT ) );
120 : case PINWHEELWIPE: {
121 : sal_Int32 blades;
122 0 : switch (nSubType) {
123 : case ONEBLADE:
124 0 : blades = 1;
125 0 : break;
126 : case THREEBLADE:
127 0 : blades = 3;
128 0 : break;
129 : case FOURBLADE:
130 0 : blades = 4;
131 0 : break;
132 : case EIGHTBLADE:
133 0 : blades = 8;
134 0 : break;
135 : default:
136 0 : blades = 2;
137 0 : break;
138 : }
139 : return ParametricPolyPolygonSharedPtr(
140 0 : new PinWheelWipe( blades ) );
141 : }
142 : case SNAKEWIPE:
143 : return ParametricPolyPolygonSharedPtr(
144 : new SnakeWipe(
145 : // elements:
146 : 8 * 8,
147 : // diagonal:
148 0 : nSubType == TOPLEFTDIAGONAL ||
149 0 : nSubType == TOPRIGHTDIAGONAL ||
150 0 : nSubType == BOTTOMRIGHTDIAGONAL ||
151 : nSubType == BOTTOMLEFTDIAGONAL,
152 : // flipOnYAxis:
153 0 : nSubType == TOPLEFTVERTICAL ||
154 0 : nSubType == TOPRIGHTDIAGONAL ||
155 : nSubType == BOTTOMLEFTDIAGONAL
156 0 : ) );
157 : case PARALLELSNAKESWIPE:
158 : return ParametricPolyPolygonSharedPtr(
159 : new ParallelSnakesWipe(
160 : // elements:
161 : 8 * 8,
162 : // diagonal:
163 0 : nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
164 : nSubType == DIAGONALTOPLEFTOPPOSITE,
165 : // flipOnYAxis:
166 0 : nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
167 0 : nSubType == HORIZONTALTOPLEFTOPPOSITE ||
168 : nSubType == DIAGONALTOPLEFTOPPOSITE,
169 : // opposite:
170 0 : nSubType == VERTICALTOPLEFTOPPOSITE ||
171 0 : nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
172 0 : nSubType == HORIZONTALTOPLEFTOPPOSITE ||
173 0 : nSubType == HORIZONTALTOPRIGHTOPPOSITE ||
174 0 : nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
175 : nSubType == DIAGONALTOPLEFTOPPOSITE
176 0 : ) );
177 : case SPIRALWIPE:
178 : return ParametricPolyPolygonSharedPtr(
179 : new SpiralWipe(
180 : // elements:
181 : 8 * 8,
182 : // flipOnYAxis:
183 0 : nSubType == TOPLEFTCOUNTERCLOCKWISE ||
184 0 : nSubType == TOPRIGHTCOUNTERCLOCKWISE ||
185 0 : nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE ||
186 0 : nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ) );
187 : case BOXSNAKESWIPE:
188 : return ParametricPolyPolygonSharedPtr(
189 : new BoxSnakesWipe(
190 : // elements:
191 : 8 * 8,
192 : // fourBox:
193 0 : nSubType == FOURBOXVERTICAL ||
194 0 : nSubType == FOURBOXHORIZONTAL ) );
195 : case SINGLESWEEPWIPE:
196 : return ParametricPolyPolygonSharedPtr(
197 : new SweepWipe(
198 : // center:
199 0 : nSubType == CLOCKWISETOP ||
200 0 : nSubType == CLOCKWISERIGHT ||
201 0 : nSubType == CLOCKWISEBOTTOM ||
202 : nSubType == CLOCKWISELEFT,
203 : // single:
204 : true,
205 : // oppositeVertical:
206 : false,
207 : // flipOnYAxis:
208 0 : nSubType == COUNTERCLOCKWISEBOTTOMLEFT ||
209 : nSubType == COUNTERCLOCKWISETOPRIGHT
210 0 : ) );
211 : case DOUBLESWEEPWIPE:
212 : return ParametricPolyPolygonSharedPtr(
213 : new SweepWipe(
214 : // center:
215 0 : nSubType == PARALLELVERTICAL ||
216 0 : nSubType == PARALLELDIAGONAL ||
217 0 : nSubType == OPPOSITEVERTICAL ||
218 : nSubType == OPPOSITEHORIZONTAL,
219 : // single:
220 : false,
221 : // oppositeVertical:
222 0 : nSubType == OPPOSITEVERTICAL ||
223 : nSubType == OPPOSITEHORIZONTAL,
224 : // flipOnYAxis:
225 0 : false ) );
226 : case DOUBLEFANWIPE:
227 : return ParametricPolyPolygonSharedPtr(
228 : new FanWipe(
229 : //center:
230 : true,
231 : // single:
232 : false,
233 : // fanIn:
234 0 : nSubType == FANINVERTICAL ||
235 0 : nSubType == FANINHORIZONTAL ) );
236 : case TRIANGLEWIPE:
237 : return ParametricPolyPolygonSharedPtr(
238 0 : FigureWipe::createTriangleWipe() );
239 : case ARROWHEADWIPE:
240 : return ParametricPolyPolygonSharedPtr(
241 0 : FigureWipe::createArrowHeadWipe() );
242 : case PENTAGONWIPE:
243 : return ParametricPolyPolygonSharedPtr(
244 0 : FigureWipe::createPentagonWipe() );
245 : case HEXAGONWIPE:
246 : return ParametricPolyPolygonSharedPtr(
247 0 : FigureWipe::createHexagonWipe() );
248 : case STARWIPE: {
249 : sal_Int32 points;
250 0 : switch (nSubType) {
251 : case FIVEPOINT:
252 0 : points = 5;
253 0 : break;
254 : case SIXPOINT:
255 0 : points = 6;
256 0 : break;
257 : default:
258 0 : points = 4;
259 0 : break;
260 : }
261 : return ParametricPolyPolygonSharedPtr(
262 0 : FigureWipe::createStarWipe(points) );
263 : }
264 : case MISCDIAGONALWIPE: {
265 0 : switch (nSubType) {
266 : case DOUBLEBARNDOOR:
267 : return ParametricPolyPolygonSharedPtr(
268 0 : new BarnDoorWipe( true /* doubled */ ) );
269 : case DOUBLEDIAMOND:
270 : return ParametricPolyPolygonSharedPtr(
271 0 : new DoubleDiamondWipe );
272 : }
273 0 : break;
274 : }
275 : case ZIGZAGWIPE:
276 0 : return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) );
277 : case BARNZIGZAGWIPE:
278 0 : return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) );
279 :
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 0 : new BarWipePolyPolygon );
290 :
291 : default:
292 : case PUSHWIPE:
293 : case SLIDEWIPE:
294 : case FADE:
295 0 : ENSURE_OR_THROW( false,
296 : "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
297 : }
298 :
299 0 : return ParametricPolyPolygonSharedPtr();
300 : }
301 : }
302 : }
303 :
304 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|