1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: parametricpolypolygonfactory.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_slideshow.hxx"
34 #include <canvas/debug.hxx>
35 #include <tools/diagnose_ex.h>
37 #include <com/sun/star/animations/TransitionType.hpp>
38 #include <com/sun/star/animations/TransitionSubType.hpp>
40 #include "parametricpolypolygonfactory.hxx"
41 #include "barwipepolypolygon.hxx"
42 #include "boxwipe.hxx"
43 #include "fourboxwipe.hxx"
44 #include "barndoorwipe.hxx"
45 #include "doublediamondwipe.hxx"
46 #include "veewipe.hxx"
47 #include "iriswipe.hxx"
48 #include "ellipsewipe.hxx"
49 #include "checkerboardwipe.hxx"
50 #include "randomwipe.hxx"
51 #include "waterfallwipe.hxx"
52 #include "clockwipe.hxx"
53 #include "fanwipe.hxx"
54 #include "pinwheelwipe.hxx"
55 #include "snakewipe.hxx"
56 #include "spiralwipe.hxx"
57 #include "sweepwipe.hxx"
58 #include "figurewipe.hxx"
59 #include "zigzagwipe.hxx"
62 using namespace ::com::sun::star
;
68 ParametricPolyPolygonSharedPtr
69 ParametricPolyPolygonFactory::createClipPolyPolygon(
70 sal_Int16 nType
, sal_Int16 nSubType
)
72 using namespace ::com::sun::star::animations::TransitionType
;
73 using namespace ::com::sun::star::animations::TransitionSubType
;
78 return ParametricPolyPolygonSharedPtr(
79 new BarWipePolyPolygon
);
81 return ParametricPolyPolygonSharedPtr(
82 new BarWipePolyPolygon( 6 ) );
84 return ParametricPolyPolygonSharedPtr(
85 new BoxWipe( nSubType
== LEFTCENTER
||
86 nSubType
== TOPCENTER
||
87 nSubType
== RIGHTCENTER
||
88 nSubType
== BOTTOMCENTER
) );
90 return ParametricPolyPolygonSharedPtr(
91 new FourBoxWipe( nSubType
== CORNERSOUT
) );
93 return ParametricPolyPolygonSharedPtr(
96 return ParametricPolyPolygonSharedPtr(
97 new BarWipePolyPolygon
);
99 return ParametricPolyPolygonSharedPtr(
102 return ParametricPolyPolygonSharedPtr(
105 return ParametricPolyPolygonSharedPtr(
106 new EllipseWipe(nSubType
) );
107 case CHECKERBOARDWIPE
:
108 return ParametricPolyPolygonSharedPtr(
109 new CheckerBoardWipe
);
111 return ParametricPolyPolygonSharedPtr(
112 new RandomWipe( 128, true /* bars */ ) );
114 return ParametricPolyPolygonSharedPtr(
115 new RandomWipe( 16 * 16, // for now until dxcanvas is faster
116 // 64 * 64 /* elements */,
117 false /* dissolve */ ) );
119 return ParametricPolyPolygonSharedPtr(
123 nSubType
== VERTICALRIGHT
||
124 nSubType
== HORIZONTALLEFT
) );
126 return ParametricPolyPolygonSharedPtr(
129 return ParametricPolyPolygonSharedPtr(
130 new FanWipe( // center:
131 nSubType
== CENTERTOP
||
132 nSubType
== CENTERRIGHT
) );
152 return ParametricPolyPolygonSharedPtr(
153 new PinWheelWipe( blades
) );
156 return ParametricPolyPolygonSharedPtr(
161 nSubType
== TOPLEFTDIAGONAL
||
162 nSubType
== TOPRIGHTDIAGONAL
||
163 nSubType
== BOTTOMRIGHTDIAGONAL
||
164 nSubType
== BOTTOMLEFTDIAGONAL
,
166 nSubType
== TOPLEFTVERTICAL
||
167 nSubType
== TOPRIGHTDIAGONAL
||
168 nSubType
== BOTTOMLEFTDIAGONAL
170 case PARALLELSNAKESWIPE
:
171 return ParametricPolyPolygonSharedPtr(
172 new ParallelSnakesWipe(
176 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
177 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
179 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
180 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
181 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
183 nSubType
== VERTICALTOPLEFTOPPOSITE
||
184 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
185 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
186 nSubType
== HORIZONTALTOPRIGHTOPPOSITE
||
187 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
188 nSubType
== DIAGONALTOPLEFTOPPOSITE
191 return ParametricPolyPolygonSharedPtr(
196 nSubType
== TOPLEFTCOUNTERCLOCKWISE
||
197 nSubType
== TOPRIGHTCOUNTERCLOCKWISE
||
198 nSubType
== BOTTOMRIGHTCOUNTERCLOCKWISE
||
199 nSubType
== BOTTOMLEFTCOUNTERCLOCKWISE
) );
201 return ParametricPolyPolygonSharedPtr(
206 nSubType
== FOURBOXVERTICAL
||
207 nSubType
== FOURBOXHORIZONTAL
) );
208 case SINGLESWEEPWIPE
:
209 return ParametricPolyPolygonSharedPtr(
212 nSubType
== CLOCKWISETOP
||
213 nSubType
== CLOCKWISERIGHT
||
214 nSubType
== CLOCKWISEBOTTOM
||
215 nSubType
== CLOCKWISELEFT
,
221 nSubType
== COUNTERCLOCKWISEBOTTOMLEFT
||
222 nSubType
== COUNTERCLOCKWISETOPRIGHT
224 case DOUBLESWEEPWIPE
:
225 return ParametricPolyPolygonSharedPtr(
228 nSubType
== PARALLELVERTICAL
||
229 nSubType
== PARALLELDIAGONAL
||
230 nSubType
== OPPOSITEVERTICAL
||
231 nSubType
== OPPOSITEHORIZONTAL
,
235 nSubType
== OPPOSITEVERTICAL
||
236 nSubType
== OPPOSITEHORIZONTAL
,
240 return ParametricPolyPolygonSharedPtr(
247 nSubType
== FANINVERTICAL
||
248 nSubType
== FANINHORIZONTAL
) );
250 return ParametricPolyPolygonSharedPtr(
251 FigureWipe::createTriangleWipe() );
253 return ParametricPolyPolygonSharedPtr(
254 FigureWipe::createArrowHeadWipe() );
256 return ParametricPolyPolygonSharedPtr(
257 FigureWipe::createPentagonWipe() );
259 return ParametricPolyPolygonSharedPtr(
260 FigureWipe::createHexagonWipe() );
274 return ParametricPolyPolygonSharedPtr(
275 FigureWipe::createStarWipe(points
) );
277 case MISCDIAGONALWIPE
: {
280 return ParametricPolyPolygonSharedPtr(
281 new BarnDoorWipe( true /* doubled */ ) );
283 return ParametricPolyPolygonSharedPtr(
284 new DoubleDiamondWipe
);
289 return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) );
291 return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) );
300 // for now, map to barwipe transition
301 return ParametricPolyPolygonSharedPtr(
302 new BarWipePolyPolygon
);
308 ENSURE_OR_THROW( false,
309 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
312 return ParametricPolyPolygonSharedPtr();