Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "model/SlsVisualState.hxx"
30 : : #include "model/SlsPageDescriptor.hxx"
31 : : #include "controller/SlsAnimator.hxx"
32 : :
33 : : namespace sd { namespace slidesorter { namespace model {
34 : :
35 : 150 : VisualState::VisualState (const sal_Int32 nPageId)
36 : : : mnPageId(nPageId),
37 : : meCurrentVisualState(VS_None),
38 : : meOldVisualState(VS_None),
39 : : mnStateAnimationId(controller::Animator::NotAnAnimationId),
40 : : maLocationOffset(0,0),
41 : : mnLocationAnimationId(controller::Animator::NotAnAnimationId),
42 : : mnButtonAlpha(1.0),
43 : : mnButtonBarAlpha(1.0),
44 : 150 : mnButtonAlphaAnimationId(controller::Animator::NotAnAnimationId)
45 : : {
46 : 150 : }
47 : :
48 : 150 : VisualState::~VisualState (void)
49 : : {
50 [ + - ]: 150 : if (mnStateAnimationId != controller::Animator::NotAnAnimationId
51 : : || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
52 : : {
53 : : OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
54 : : OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
55 : : }
56 : 150 : }
57 : :
58 : 958 : void VisualState::SetVisualState (const State eState)
59 : : {
60 : 958 : meOldVisualState = meCurrentVisualState;
61 : 958 : meCurrentVisualState = eState;
62 : 958 : }
63 : :
64 : :
65 : 958 : void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
66 : : {
67 [ - + ]: 958 : if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
68 : 0 : SetVisualState(VS_Excluded);
69 [ + + ]: 958 : else if (rDescriptor.HasState(PageDescriptor::ST_Current))
70 : 792 : SetVisualState(VS_Current);
71 [ - + ]: 166 : else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
72 : 0 : SetVisualState(VS_Focused);
73 [ + + ]: 166 : else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
74 : 138 : SetVisualState(VS_Selected);
75 : : else
76 : 28 : SetVisualState(VS_None);
77 : :
78 : 958 : SetMouseOverState(rDescriptor.HasState(PageDescriptor::ST_MouseOver));
79 : 958 : }
80 : :
81 : :
82 : 958 : void VisualState::SetMouseOverState (const bool bIsMouseOver)
83 : : {
84 : 958 : mbOldMouseOverState = mbCurrentMouseOverState;
85 : 958 : mbCurrentMouseOverState = bIsMouseOver;
86 : 958 : }
87 : :
88 : :
89 : 3692 : Point VisualState::GetLocationOffset (void) const
90 : : {
91 : 3692 : return maLocationOffset;
92 : : }
93 : :
94 : :
95 : 0 : bool VisualState::SetLocationOffset (const Point& rOffset)
96 : : {
97 [ # # ]: 0 : if (maLocationOffset != rOffset)
98 : : {
99 : 0 : maLocationOffset = rOffset;
100 : 0 : return true;
101 : : }
102 : : else
103 : 0 : return false;
104 : : }
105 : :
106 : :
107 : 0 : double VisualState::GetButtonAlpha (void) const
108 : : {
109 : 0 : return mnButtonAlpha;
110 : : }
111 : :
112 : :
113 : 0 : void VisualState::SetButtonAlpha (const double nAlpha)
114 : : {
115 : 0 : mnButtonAlpha = nAlpha;
116 : 0 : }
117 : :
118 : :
119 : 677 : double VisualState::GetButtonBarAlpha (void) const
120 : : {
121 : 677 : return mnButtonBarAlpha;
122 : : }
123 : :
124 : :
125 : 0 : void VisualState::SetButtonBarAlpha (const double nAlpha)
126 : : {
127 : 0 : mnButtonBarAlpha = nAlpha;
128 : 0 : }
129 : :
130 : :
131 : 0 : sal_Int32 VisualState::GetButtonAlphaAnimationId (void) const
132 : : {
133 : 0 : return mnButtonAlphaAnimationId;
134 : : }
135 : :
136 : :
137 : 0 : void VisualState::SetButtonAlphaAnimationId (const sal_Int32 nAnimationId)
138 : : {
139 : 0 : mnButtonAlphaAnimationId = nAnimationId;
140 : 0 : }
141 : :
142 : :
143 : : } } } // end of namespace ::sd::slidesorter::model
144 : :
145 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|