1 /* This file is part of the KDE project
2 Copyright (C) 2008 Sven Langkamp <sven.langkamp@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "KPrSingleSweepWipeEffectFactory.h"
21
22 #include <klocalizedstring.h>
23
24 #include "KPrSingleSweepWipeStrategy.h"
25
26 #define SingleSweepWipeEffectId "SingleSweepWipeEffect"
27
KPrSingleSweepWipeEffectFactory()28 KPrSingleSweepWipeEffectFactory::KPrSingleSweepWipeEffectFactory()
29 : KPrPageEffectFactory( SingleSweepWipeEffectId, i18n( "Single Sweep" ) )
30 {
31 addStrategy( new KPrSingleSweepWipeStrategy( 0.5, 0.0, 0, -180,
32 ClockwiseTop, "singleSweepWipe", "clockwiseTop", false ) );
33 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 0.5, 270, -180,
34 ClockwiseRight, "singleSweepWipe", "clockwiseRight", false ) );
35 addStrategy( new KPrSingleSweepWipeStrategy( 0.5, 1.0, 180, -180,
36 ClockwiseBottom, "singleSweepWipe", "clockwiseBottom", false ) );
37 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 0.5, 90, -180,
38 ClockwiseLeft, "singleSweepWipe", "clockwiseLeft", false ) );
39 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 0.0, 0, -90,
40 ClockwiseTopLeft, "singleSweepWipe", "clockwiseTopLeft", false ) );
41 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 1.0, 0, 90,
42 CounterClockwiseBottomLeft, "singleSweepWipe", "counterClockwiseBottomLeft", false ) );
43 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 1.0, 180, -90,
44 ClockwiseBottomRight, "singleSweepWipe", "clockwiseBottomRight", false ) );
45 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 0.0, 180, 90,
46 CounterClockwiseTopRight, "singleSweepWipe", "counterClockwiseTopRight", false ) );
47 addStrategy( new KPrSingleSweepWipeStrategy( 0.5, 0.0, 180, 180,
48 CounterClockwiseTop, "singleSweepWipe", "clockwiseTop", true ) );
49 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 0.5, 90, 180,
50 CounterClockwiseRight, "singleSweepWipe", "clockwiseRight", true ) );
51 addStrategy( new KPrSingleSweepWipeStrategy( 0.5, 1.0, 0, 180,
52 CounterClockwiseBottom, "singleSweepWipe", "clockwiseBottom", true ) );
53 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 0.5, 270, 180,
54 CounterClockwiseLeft, "singleSweepWipe", "clockwiseLeft", true ) );
55 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 0.0, 270, 90,
56 CounterClockwiseTopLeft, "singleSweepWipe", "clockwiseTopLeft", true ) );
57 addStrategy( new KPrSingleSweepWipeStrategy( 0.0, 1.0, 90, -90,
58 ClockwiseBottomLeft, "singleSweepWipe", "counterClockwiseBottomLeft", true ) );
59 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 1.0, 90, 90,
60 CounterClockwiseBottomRight, "singleSweepWipe", "clockwiseBottomRight", true ) );
61 addStrategy( new KPrSingleSweepWipeStrategy( 1.0, 0.0, 270, -90,
62 ClockwiseTopRight, "singleSweepWipe", "counterClockwiseTopRight", true ) );
63 }
64
~KPrSingleSweepWipeEffectFactory()65 KPrSingleSweepWipeEffectFactory::~KPrSingleSweepWipeEffectFactory()
66 {
67 }
68
69 static const char* const s_subTypes[] = {
70 I18N_NOOP( "Clockwise Top" ),
71 I18N_NOOP( "Clockwise Right" ),
72 I18N_NOOP( "Clockwise Bottom" ),
73 I18N_NOOP( "Clockwise Left" ),
74 I18N_NOOP( "Clockwise Top Left" ),
75 I18N_NOOP( "Counterclockwise Bottom Left" ),
76 I18N_NOOP( "Clockwise Bottom Right" ),
77 I18N_NOOP( "Counterclockwise Top Right" ),
78 I18N_NOOP( "Counterclockwise Top" ),
79 I18N_NOOP( "Counterclockwise Right" ),
80 I18N_NOOP( "Counterclockwise Bottom" ),
81 I18N_NOOP( "Counterclockwise Left" ),
82 I18N_NOOP( "Counterclockwise Top Left" ),
83 I18N_NOOP( "Clockwise Bottom Left" ),
84 I18N_NOOP( "Counterclockwise Bottom Right" ),
85 I18N_NOOP( "Clockwise Top Right" )
86 };
87
subTypeName(int subType) const88 QString KPrSingleSweepWipeEffectFactory::subTypeName(int subType) const
89 {
90 if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
91 return i18n( s_subTypes[subType] );
92 } else {
93 return i18n( "Unknown subtype" );
94 }
95 }
96