LibreOffice Module slideshow (master) 1
parametricpolypolygonfactory.cxx
Go to the documentation of this file.
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
22
23#include <com/sun/star/animations/TransitionType.hpp>
24#include <com/sun/star/animations/TransitionSubType.hpp>
25
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"
46
47
48using namespace ::com::sun::star;
49
50namespace slideshow::internal
51{
54 sal_Int16 nType, sal_Int16 nSubType )
55 {
56 using namespace ::com::sun::star::animations::TransitionType;
57 using namespace ::com::sun::star::animations::TransitionSubType;
58
59 switch (nType)
60 {
61 case BARWIPE:
62 return std::make_shared<BarWipePolyPolygon>();
63 case BLINDSWIPE:
64 return std::make_shared<BarWipePolyPolygon>( 6 );
65 case BOXWIPE:
66 return std::make_shared<BoxWipe>( nSubType == LEFTCENTER ||
67 nSubType == TOPCENTER ||
68 nSubType == RIGHTCENTER||
69 nSubType == BOTTOMCENTER );
70 case FOURBOXWIPE:
71 return std::make_shared<FourBoxWipe>( nSubType == CORNERSOUT );
72 case BARNDOORWIPE:
73 return std::make_shared<BarnDoorWipe>();
74 case DIAGONALWIPE:
75 return std::make_shared<BarWipePolyPolygon>();
76 case VEEWIPE:
77 return std::make_shared<VeeWipe>();
78 case IRISWIPE:
79 return std::make_shared<IrisWipe>();
80 case ELLIPSEWIPE:
81 return std::make_shared<EllipseWipe>(nSubType);
82 case CHECKERBOARDWIPE:
83 return std::make_shared<CheckerBoardWipe>();
84 case RANDOMBARWIPE:
85 return std::make_shared<RandomWipe>( 128, true /* bars */ );
86 case DISSOLVE:
87 return std::make_shared<RandomWipe>( 16 * 16, // for now until dxcanvas is faster
88// 64 * 64 /* elements */,
89 false /* dissolve */ );
90 case WATERFALLWIPE:
91 return std::make_shared<WaterfallWipe>(
92 128,
93 // flipOnYAxis:
94 nSubType == VERTICALRIGHT ||
95 nSubType == HORIZONTALLEFT );
96 case CLOCKWIPE:
97 return std::make_shared<ClockWipe>();
98 case FANWIPE:
99 return std::make_shared<FanWipe>( // center:
100 nSubType == CENTERTOP ||
101 nSubType == CENTERRIGHT );
102 case PINWHEELWIPE: {
103 sal_Int32 blades;
104 switch (nSubType) {
105 case ONEBLADE:
106 blades = 1;
107 break;
108 case THREEBLADE:
109 blades = 3;
110 break;
111 case FOURBLADE:
112 blades = 4;
113 break;
114 case EIGHTBLADE:
115 blades = 8;
116 break;
117 default:
118 blades = 2;
119 break;
120 }
121 return std::make_shared<PinWheelWipe>( blades );
122 }
123 case SNAKEWIPE:
124 return std::make_shared<SnakeWipe>(
125 // elements:
126 8 * 8,
127 // diagonal:
128 nSubType == TOPLEFTDIAGONAL ||
129 nSubType == TOPRIGHTDIAGONAL ||
130 nSubType == BOTTOMRIGHTDIAGONAL ||
131 nSubType == BOTTOMLEFTDIAGONAL,
132 // flipOnYAxis:
133 nSubType == TOPLEFTVERTICAL ||
134 nSubType == TOPRIGHTDIAGONAL ||
135 nSubType == BOTTOMLEFTDIAGONAL
136 );
137 case PARALLELSNAKESWIPE:
138 return std::make_shared<ParallelSnakesWipe>(
139 // elements:
140 8 * 8,
141 // diagonal:
142 nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
143 nSubType == DIAGONALTOPLEFTOPPOSITE,
144 // flipOnYAxis:
145 nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
146 nSubType == HORIZONTALTOPLEFTOPPOSITE ||
147 nSubType == DIAGONALTOPLEFTOPPOSITE,
148 // opposite:
149 nSubType == VERTICALTOPLEFTOPPOSITE ||
150 nSubType == VERTICALBOTTOMLEFTOPPOSITE ||
151 nSubType == HORIZONTALTOPLEFTOPPOSITE ||
152 nSubType == HORIZONTALTOPRIGHTOPPOSITE ||
153 nSubType == DIAGONALBOTTOMLEFTOPPOSITE ||
154 nSubType == DIAGONALTOPLEFTOPPOSITE
155 );
156 case SPIRALWIPE:
157 return std::make_shared<SpiralWipe>(
158 // elements:
159 8 * 8,
160 // flipOnYAxis:
161 nSubType == TOPLEFTCOUNTERCLOCKWISE ||
162 nSubType == TOPRIGHTCOUNTERCLOCKWISE ||
163 nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE ||
164 nSubType == BOTTOMLEFTCOUNTERCLOCKWISE );
165 case BOXSNAKESWIPE:
166 return std::make_shared<BoxSnakesWipe>(
167 // elements:
168 8 * 8,
169 // fourBox:
170 nSubType == FOURBOXVERTICAL ||
171 nSubType == FOURBOXHORIZONTAL );
172 case SINGLESWEEPWIPE:
173 return std::make_shared<SweepWipe>(
174 // center:
175 nSubType == CLOCKWISETOP ||
176 nSubType == CLOCKWISERIGHT ||
177 nSubType == CLOCKWISEBOTTOM ||
178 nSubType == CLOCKWISELEFT,
179 // single:
180 true,
181 // oppositeVertical:
182 false,
183 // flipOnYAxis:
184 nSubType == COUNTERCLOCKWISEBOTTOMLEFT ||
185 nSubType == COUNTERCLOCKWISETOPRIGHT
186 );
187 case DOUBLESWEEPWIPE:
188 return std::make_shared<SweepWipe>(
189 // center:
190 nSubType == PARALLELVERTICAL ||
191 nSubType == PARALLELDIAGONAL ||
192 nSubType == OPPOSITEVERTICAL ||
193 nSubType == OPPOSITEHORIZONTAL,
194 // single:
195 false,
196 // oppositeVertical:
197 nSubType == OPPOSITEVERTICAL ||
198 nSubType == OPPOSITEHORIZONTAL,
199 // flipOnYAxis:
200 false );
201 case DOUBLEFANWIPE:
202 return std::make_shared<FanWipe>(
203 //center:
204 true,
205 // single:
206 false,
207 // fanIn:
208 nSubType == FANINVERTICAL ||
209 nSubType == FANINHORIZONTAL );
210 case TRIANGLEWIPE:
212 case ARROWHEADWIPE:
214 case PENTAGONWIPE:
216 case HEXAGONWIPE:
218 case STARWIPE: {
219 sal_Int32 points;
220 switch (nSubType) {
221 case FIVEPOINT:
222 points = 5;
223 break;
224 case SIXPOINT:
225 points = 6;
226 break;
227 default:
228 points = 4;
229 break;
230 }
231 return FigureWipe::createStarWipe(points);
232 }
233 case MISCDIAGONALWIPE: {
234 switch (nSubType) {
235 case DOUBLEBARNDOOR:
236 return std::make_shared<BarnDoorWipe>( true /* doubled */ );
237 case DOUBLEDIAMOND:
238 return std::make_shared<DoubleDiamondWipe>();
239 }
240 break;
241 }
242 case ZIGZAGWIPE:
243 return std::make_shared<ZigZagWipe>(5);
244 case BARNZIGZAGWIPE:
245 return std::make_shared<BarnZigZagWipe>(5);
246
247 case BOWTIEWIPE:
248 case BARNVEEWIPE:
249 case EYEWIPE:
250 case ROUNDRECTWIPE:
251 case MISCSHAPEWIPE:
252 case SALOONDOORWIPE:
253 case WINDSHIELDWIPE:
254 // for now, map to barwipe transition
255 return std::make_shared<BarWipePolyPolygon>();
256
257 default:
258 case PUSHWIPE:
259 case SLIDEWIPE:
260 case FADE:
261 ENSURE_OR_THROW( false,
262 "createShapeClipPolyPolygonAnimation(): Transition type mismatch" );
263 }
264
266 }
267}
268
269/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static std::shared_ptr< FigureWipe > createTriangleWipe()
Definition: figurewipe.cxx:37
static std::shared_ptr< FigureWipe > createPentagonWipe()
Definition: figurewipe.cxx:63
static std::shared_ptr< FigureWipe > createStarWipe(sal_Int32 nPoints)
Definition: figurewipe.cxx:92
static std::shared_ptr< FigureWipe > createHexagonWipe()
Definition: figurewipe.cxx:77
static std::shared_ptr< FigureWipe > createArrowHeadWipe()
Definition: figurewipe.cxx:49
#define ENSURE_OR_THROW(c, m)
ParametricPolyPolygonSharedPtr createClipPolyPolygon(sal_Int16 nTransitionType, sal_Int16 nTransitionSubType)
::std::shared_ptr< ParametricPolyPolygon > ParametricPolyPolygonSharedPtr
QPRO_FUNC_TYPE nType