1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #if ! defined INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX
29 #define INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX
30 
31 #include <sal/types.h>
32 
33 
34 namespace slideshow {
35 namespace internal {
36 
37 struct TransitionInfo
38 {
39     // the following two member serve as the search key
40     // for an incoming XTransitionFilter node
41     //
42     // {
43 
44     sal_Int16       mnTransitionType;
45     sal_Int16       mnTransitionSubType;
46 
47     // }
48     //
49 
50     /** This enum classifies a transition type
51      */
52     enum TransitionClass
53     {
54         /// Invalid type
55         TRANSITION_INVALID,
56 
57         /// Transition expressed by parametric clip polygon
58         TRANSITION_CLIP_POLYPOLYGON,
59 
60         /// Transition expressed by hand-crafted function
61         TRANSITION_SPECIAL
62     };
63 
64     /// class of effect handling
65     TransitionClass meTransitionClass;
66 
67     /// Rotation angle of clip polygon
68     double          mnRotationAngle;
69 
70     /// X scaling of clip polygon (negative values mirror)
71     double          mnScaleX;
72 
73     /// Y scaling of clip polygon (negative values mirror)
74     double          mnScaleY;
75 
76     /** This enum determines the method how to reverse
77         a parametric clip polygon transition.
78 
79         A reversed transition runs in the geometrically
80         opposite direction. For a left-to-right bar wipe, the
81         reversed transition is a right-to-left wipe, whereas
82         for an iris transition, the reversed mode will show
83         the target in the outer area (instead of in the inner
84         area, as in normal mode).
85     */
86     enum ReverseMethod
87     {
88         /** Ignore direction attribute altogether
89             (if it has no sensible meaning for this transition)
90         */
91         REVERSEMETHOD_IGNORE,
92 
93         /** Revert by changing the direction of the parameter sweep
94             (from 1->0 instead of 0->1)
95         */
96         REVERSEMETHOD_INVERT_SWEEP,
97 
98         /** Revert by subtracting the generated polygon from the
99             target bound rect
100         */
101         REVERSEMETHOD_SUBTRACT_POLYGON,
102 
103         /** Combination of REVERSEMETHOD_INVERT_SWEEP and
104             REVERSEMETHOD_SUBTRACT_POLYGON.
105         */
106         REVERSEMETHOD_SUBTRACT_AND_INVERT,
107 
108         /// Reverse by rotating polygon 180 degrees
109         REVERSEMETHOD_ROTATE_180,
110 
111         /// Reverse by flipping polygon at the y (!) axis
112         REVERSEMETHOD_FLIP_X,
113 
114         /// Reverse by flipping polygon at the x (!) axis
115         REVERSEMETHOD_FLIP_Y
116     };
117 
118     /** Indicating the method to use when transition
119         should be 'reversed'.
120 
121         @see ReverseMethod
122     */
123     ReverseMethod   meReverseMethod;
124 
125     /** When true, transition 'out' effects are realized
126         by inverting the parameter sweep direction (1->0
127         instead of 0->1). Otherwise, 'out' effects are
128         realized by changing inside and outside areas of
129         the parametric poly-polygon.
130     */
131     bool            mbOutInvertsSweep;
132 
133     /** when true, scale clip polygon isotrophically to
134         target size.  when false, scale is
135         anisotrophically.
136     */
137     bool            mbScaleIsotrophically;
138 
139 
140     /// Compare against type and subtype
141     class Comparator
142     {
143         sal_Int16 mnTransitionType;
144         sal_Int16 mnTransitionSubType;
145     public:
146         Comparator( sal_Int16 nTransitionType,
147                     sal_Int16 nTransitionSubType )
148             : mnTransitionType( nTransitionType ),
149               mnTransitionSubType( nTransitionSubType ) {}
150         bool operator()( const TransitionInfo& rEntry ) const {
151             return rEntry.mnTransitionType == mnTransitionType &&
152                 rEntry.mnTransitionSubType == mnTransitionSubType;
153         }
154     };
155 };
156 
157 } // namespace internal
158 } // namespace presentation
159 
160 #endif /* INCLUDED_SLIDESHOW_TRANSITIONINFO_HXX */
161