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 <comphelper/diagnose_ex.hxx>
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::internal
52 ParametricPolyPolygonSharedPtr
53 ParametricPolyPolygonFactory::createClipPolyPolygon(
54 sal_Int16 nType
, sal_Int16 nSubType
)
56 using namespace ::com::sun::star::animations::TransitionType
;
57 using namespace ::com::sun::star::animations::TransitionSubType
;
62 return std::make_shared
<BarWipePolyPolygon
>();
64 return std::make_shared
<BarWipePolyPolygon
>( 6 );
66 return std::make_shared
<BoxWipe
>( nSubType
== LEFTCENTER
||
67 nSubType
== TOPCENTER
||
68 nSubType
== RIGHTCENTER
||
69 nSubType
== BOTTOMCENTER
);
71 return std::make_shared
<FourBoxWipe
>( nSubType
== CORNERSOUT
);
73 return std::make_shared
<BarnDoorWipe
>();
75 return std::make_shared
<BarWipePolyPolygon
>();
77 return std::make_shared
<VeeWipe
>();
79 return std::make_shared
<IrisWipe
>();
81 return std::make_shared
<EllipseWipe
>(nSubType
);
82 case CHECKERBOARDWIPE
:
83 return std::make_shared
<CheckerBoardWipe
>();
85 return std::make_shared
<RandomWipe
>( 128, true /* bars */ );
87 return std::make_shared
<RandomWipe
>( 16 * 16, // for now until dxcanvas is faster
88 // 64 * 64 /* elements */,
89 false /* dissolve */ );
91 return std::make_shared
<WaterfallWipe
>(
94 nSubType
== VERTICALRIGHT
||
95 nSubType
== HORIZONTALLEFT
);
97 return std::make_shared
<ClockWipe
>();
99 return std::make_shared
<FanWipe
>( // center:
100 nSubType
== CENTERTOP
||
101 nSubType
== CENTERRIGHT
);
121 return std::make_shared
<PinWheelWipe
>( blades
);
124 return std::make_shared
<SnakeWipe
>(
128 nSubType
== TOPLEFTDIAGONAL
||
129 nSubType
== TOPRIGHTDIAGONAL
||
130 nSubType
== BOTTOMRIGHTDIAGONAL
||
131 nSubType
== BOTTOMLEFTDIAGONAL
,
133 nSubType
== TOPLEFTVERTICAL
||
134 nSubType
== TOPRIGHTDIAGONAL
||
135 nSubType
== BOTTOMLEFTDIAGONAL
137 case PARALLELSNAKESWIPE
:
138 return std::make_shared
<ParallelSnakesWipe
>(
142 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
143 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
145 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
146 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
147 nSubType
== DIAGONALTOPLEFTOPPOSITE
,
149 nSubType
== VERTICALTOPLEFTOPPOSITE
||
150 nSubType
== VERTICALBOTTOMLEFTOPPOSITE
||
151 nSubType
== HORIZONTALTOPLEFTOPPOSITE
||
152 nSubType
== HORIZONTALTOPRIGHTOPPOSITE
||
153 nSubType
== DIAGONALBOTTOMLEFTOPPOSITE
||
154 nSubType
== DIAGONALTOPLEFTOPPOSITE
157 return std::make_shared
<SpiralWipe
>(
161 nSubType
== TOPLEFTCOUNTERCLOCKWISE
||
162 nSubType
== TOPRIGHTCOUNTERCLOCKWISE
||
163 nSubType
== BOTTOMRIGHTCOUNTERCLOCKWISE
||
164 nSubType
== BOTTOMLEFTCOUNTERCLOCKWISE
);
166 return std::make_shared
<BoxSnakesWipe
>(
170 nSubType
== FOURBOXVERTICAL
||
171 nSubType
== FOURBOXHORIZONTAL
);
172 case SINGLESWEEPWIPE
:
173 return std::make_shared
<SweepWipe
>(
175 nSubType
== CLOCKWISETOP
||
176 nSubType
== CLOCKWISERIGHT
||
177 nSubType
== CLOCKWISEBOTTOM
||
178 nSubType
== CLOCKWISELEFT
,
184 nSubType
== COUNTERCLOCKWISEBOTTOMLEFT
||
185 nSubType
== COUNTERCLOCKWISETOPRIGHT
187 case DOUBLESWEEPWIPE
:
188 return std::make_shared
<SweepWipe
>(
190 nSubType
== PARALLELVERTICAL
||
191 nSubType
== PARALLELDIAGONAL
||
192 nSubType
== OPPOSITEVERTICAL
||
193 nSubType
== OPPOSITEHORIZONTAL
,
197 nSubType
== OPPOSITEVERTICAL
||
198 nSubType
== OPPOSITEHORIZONTAL
,
202 return std::make_shared
<FanWipe
>(
208 nSubType
== FANINVERTICAL
||
209 nSubType
== FANINHORIZONTAL
);
211 return FigureWipe::createTriangleWipe();
213 return FigureWipe::createArrowHeadWipe();
215 return FigureWipe::createPentagonWipe();
217 return FigureWipe::createHexagonWipe();
231 return FigureWipe::createStarWipe(points
);
233 case MISCDIAGONALWIPE
: {
236 return std::make_shared
<BarnDoorWipe
>( true /* doubled */ );
238 return std::make_shared
<DoubleDiamondWipe
>();
243 return std::make_shared
<ZigZagWipe
>(5);
245 return std::make_shared
<BarnZigZagWipe
>(5);
254 // for now, map to barwipe transition
255 return std::make_shared
<BarWipePolyPolygon
>();
261 ENSURE_OR_THROW( false,
262 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
265 return ParametricPolyPolygonSharedPtr();
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */