1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #if ! defined INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX
25 #define INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX
26 
27 #include <sal/types.h>
28 
29 
30 namespace slideshow {
31 namespace internal {
32 
33 struct TransitionInfo
34 {
35     // the following two member serve as the search key
36     // for an incoming XTransitionFilter node
37     //
38     // {
39 
40     sal_Int16       mnTransitionType;
41     sal_Int16       mnTransitionSubType;
42 
43     // }
44     //
45 
46     /** This enum classifies a transition type
47      */
48     enum TransitionClass
49     {
50         /// Invalid type
51         TRANSITION_INVALID,
52 
53         /// Transition expressed by parametric clip polygon
54         TRANSITION_CLIP_POLYPOLYGON,
55 
56         /// Transition expressed by hand-crafted function
57         TRANSITION_SPECIAL
58     };
59 
60     /// class of effect handling
61     TransitionClass meTransitionClass;
62 
63     /// Rotation angle of clip polygon
64     double          mnRotationAngle;
65 
66     /// X scaling of clip polygon (negative values mirror)
67     double          mnScaleX;
68 
69     /// Y scaling of clip polygon (negative values mirror)
70     double          mnScaleY;
71 
72     /** This enum determines the method how to reverse
73         a parametric clip polygon transition.
74 
75         A reversed transition runs in the geometrically
76         opposite direction. For a left-to-right bar wipe, the
77         reversed transition is a right-to-left wipe, whereas
78         for an iris transition, the reversed mode will show
79         the target in the outer area (instead of in the inner
80         area, as in normal mode).
81     */
82     enum ReverseMethod
83     {
84         /** Ignore direction attribute altogether
85             (if it has no sensible meaning for this transition)
86         */
87         REVERSEMETHOD_IGNORE,
88 
89         /** Revert by changing the direction of the parameter sweep
90             (from 1->0 instead of 0->1)
91         */
92         REVERSEMETHOD_INVERT_SWEEP,
93 
94         /** Revert by subtracting the generated polygon from the
95             target bound rect
96         */
97         REVERSEMETHOD_SUBTRACT_POLYGON,
98 
99         /** Combination of REVERSEMETHOD_INVERT_SWEEP and
100             REVERSEMETHOD_SUBTRACT_POLYGON.
101         */
102         REVERSEMETHOD_SUBTRACT_AND_INVERT,
103 
104         /// Reverse by rotating polygon 180 degrees
105         REVERSEMETHOD_ROTATE_180,
106 
107         /// Reverse by flipping polygon at the y (!) axis
108         REVERSEMETHOD_FLIP_X,
109 
110         /// Reverse by flipping polygon at the x (!) axis
111         REVERSEMETHOD_FLIP_Y
112     };
113 
114     /** Indicating the method to use when transition
115         should be 'reversed'.
116 
117         @see ReverseMethod
118     */
119     ReverseMethod   meReverseMethod;
120 
121     /** When true, transition 'out' effects are realized
122         by inverting the parameter sweep direction (1->0
123         instead of 0->1). Otherwise, 'out' effects are
124         realized by changing inside and outside areas of
125         the parametric poly-polygon.
126     */
127     bool            mbOutInvertsSweep;
128 
129     /** when true, scale clip polygon isotrophically to
130         target size.  when false, scale is
131         anisotrophically.
132     */
133     bool            mbScaleIsotrophically;
134 
135 
136     /// Compare against type and subtype
137     class Comparator
138     {
139         sal_Int16 mnTransitionType;
140         sal_Int16 mnTransitionSubType;
141     public:
Comparator(sal_Int16 nTransitionType,sal_Int16 nTransitionSubType)142         Comparator( sal_Int16 nTransitionType,
143                     sal_Int16 nTransitionSubType )
144             : mnTransitionType( nTransitionType ),
145               mnTransitionSubType( nTransitionSubType ) {}
operator ()(const TransitionInfo & rEntry) const146         bool operator()( const TransitionInfo& rEntry ) const {
147             return rEntry.mnTransitionType == mnTransitionType &&
148                 rEntry.mnTransitionSubType == mnTransitionSubType;
149         }
150     };
151 };
152 
153 } // namespace internal
154 } // namespace presentation
155 
156 #endif /* INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX */
157