1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
;
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
;
65 return ParametricPolyPolygonSharedPtr(
66 new BarWipePolyPolygon
);
68 return ParametricPolyPolygonSharedPtr(
69 new BarWipePolyPolygon( 6 ) );
71 return ParametricPolyPolygonSharedPtr(
72 new BoxWipe( nSubType
== LEFTCENTER
||
73 nSubType
== TOPCENTER
||
74 nSubType
== RIGHTCENTER
||
75 nSubType
== BOTTOMCENTER
) );
77 return ParametricPolyPolygonSharedPtr(
78 new FourBoxWipe( nSubType
== CORNERSOUT
) );
80 return ParametricPolyPolygonSharedPtr(
83 return ParametricPolyPolygonSharedPtr(
84 new BarWipePolyPolygon
);
86 return ParametricPolyPolygonSharedPtr(
89 return ParametricPolyPolygonSharedPtr(
92 return ParametricPolyPolygonSharedPtr(
93 new EllipseWipe(nSubType
) );
94 case CHECKERBOARDWIPE
:
95 return ParametricPolyPolygonSharedPtr(
96 new CheckerBoardWipe
);
98 return ParametricPolyPolygonSharedPtr(
99 new RandomWipe( 128, true /* bars */ ) );
101 return ParametricPolyPolygonSharedPtr(
102 new RandomWipe( 16 * 16, // for now until dxcanvas is faster
103 // 64 * 64 /* elements */,
104 false /* dissolve */ ) );
106 return ParametricPolyPolygonSharedPtr(
110 nSubType
== VERTICALRIGHT
||
111 nSubType
== HORIZONTALLEFT
) );
113 return ParametricPolyPolygonSharedPtr(
116 return ParametricPolyPolygonSharedPtr(
117 new FanWipe( // center:
118 nSubType
== CENTERTOP
||
119 nSubType
== CENTERRIGHT
) );
139 return ParametricPolyPolygonSharedPtr(
140 new PinWheelWipe( blades
) );
143 return ParametricPolyPolygonSharedPtr(
148 nSubType
== TOPLEFTDIAGONAL
||
149 nSubType
== TOPRIGHTDIAGONAL
||
150 nSubType
== BOTTOMRIGHTDIAGONAL
||
151 nSubType
== BOTTOMLEFTDIAGONAL
,
153 nSubType
== TOPLEFTVERTICAL
||
154 nSubType
== TOPRIGHTDIAGONAL
||
155 nSubType
== BOTTOMLEFTDIAGONAL
157 case PARALLELSNAKESWIPE
:
158 return ParametricPolyPolygonSharedPtr(
159 new ParallelSnakesWipe(
163 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
164 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
166 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
167 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
168 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
170 nSubType
== VERTICALTOPLEFTOPPOSITE
||
171 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
172 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
173 nSubType
== HORIZONTALTOPRIGHTOPPOSITE
||
174 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
175 nSubType
== DIAGONALTOPLEFTOPPOSITE
178 return ParametricPolyPolygonSharedPtr(
183 nSubType
== TOPLEFTCOUNTERCLOCKWISE
||
184 nSubType
== TOPRIGHTCOUNTERCLOCKWISE
||
185 nSubType
== BOTTOMRIGHTCOUNTERCLOCKWISE
||
186 nSubType
== BOTTOMLEFTCOUNTERCLOCKWISE
) );
188 return ParametricPolyPolygonSharedPtr(
193 nSubType
== FOURBOXVERTICAL
||
194 nSubType
== FOURBOXHORIZONTAL
) );
195 case SINGLESWEEPWIPE
:
196 return ParametricPolyPolygonSharedPtr(
199 nSubType
== CLOCKWISETOP
||
200 nSubType
== CLOCKWISERIGHT
||
201 nSubType
== CLOCKWISEBOTTOM
||
202 nSubType
== CLOCKWISELEFT
,
208 nSubType
== COUNTERCLOCKWISEBOTTOMLEFT
||
209 nSubType
== COUNTERCLOCKWISETOPRIGHT
211 case DOUBLESWEEPWIPE
:
212 return ParametricPolyPolygonSharedPtr(
215 nSubType
== PARALLELVERTICAL
||
216 nSubType
== PARALLELDIAGONAL
||
217 nSubType
== OPPOSITEVERTICAL
||
218 nSubType
== OPPOSITEHORIZONTAL
,
222 nSubType
== OPPOSITEVERTICAL
||
223 nSubType
== OPPOSITEHORIZONTAL
,
227 return ParametricPolyPolygonSharedPtr(
234 nSubType
== FANINVERTICAL
||
235 nSubType
== FANINHORIZONTAL
) );
237 return ParametricPolyPolygonSharedPtr(
238 FigureWipe::createTriangleWipe() );
240 return ParametricPolyPolygonSharedPtr(
241 FigureWipe::createArrowHeadWipe() );
243 return ParametricPolyPolygonSharedPtr(
244 FigureWipe::createPentagonWipe() );
246 return ParametricPolyPolygonSharedPtr(
247 FigureWipe::createHexagonWipe() );
261 return ParametricPolyPolygonSharedPtr(
262 FigureWipe::createStarWipe(points
) );
264 case MISCDIAGONALWIPE
: {
267 return ParametricPolyPolygonSharedPtr(
268 new BarnDoorWipe( true /* doubled */ ) );
270 return ParametricPolyPolygonSharedPtr(
271 new DoubleDiamondWipe
);
276 return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) );
278 return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) );
287 // for now, map to barwipe transition
288 return ParametricPolyPolygonSharedPtr(
289 new BarWipePolyPolygon
);
295 ENSURE_OR_THROW( false,
296 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
299 return ParametricPolyPolygonSharedPtr();
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */