Line data Source code
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 : #include "model/SlsVisualState.hxx"
21 : #include "model/SlsPageDescriptor.hxx"
22 : #include "controller/SlsAnimator.hxx"
23 :
24 : namespace sd { namespace slidesorter { namespace model {
25 :
26 0 : VisualState::VisualState (const sal_Int32 nPageId)
27 : : mnPageId(nPageId),
28 : meCurrentVisualState(VS_None),
29 : meOldVisualState(VS_None),
30 : mnStateAnimationId(controller::Animator::NotAnAnimationId),
31 : maLocationOffset(0,0),
32 0 : mnLocationAnimationId(controller::Animator::NotAnAnimationId)
33 : {
34 0 : }
35 :
36 0 : VisualState::~VisualState (void)
37 : {
38 0 : if (mnStateAnimationId != controller::Animator::NotAnAnimationId
39 0 : || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
40 : {
41 : OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
42 : OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
43 : }
44 0 : }
45 :
46 0 : void VisualState::SetVisualState (const State eState)
47 : {
48 0 : meOldVisualState = meCurrentVisualState;
49 0 : meCurrentVisualState = eState;
50 0 : }
51 :
52 :
53 0 : void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
54 : {
55 0 : if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
56 0 : SetVisualState(VS_Excluded);
57 0 : else if (rDescriptor.HasState(PageDescriptor::ST_Current))
58 0 : SetVisualState(VS_Current);
59 0 : else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
60 0 : SetVisualState(VS_Focused);
61 0 : else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
62 0 : SetVisualState(VS_Selected);
63 : else
64 0 : SetVisualState(VS_None);
65 0 : }
66 :
67 0 : Point VisualState::GetLocationOffset (void) const
68 : {
69 0 : return maLocationOffset;
70 : }
71 :
72 :
73 0 : bool VisualState::SetLocationOffset (const Point& rOffset)
74 : {
75 0 : if (maLocationOffset != rOffset)
76 : {
77 0 : maLocationOffset = rOffset;
78 0 : return true;
79 : }
80 : else
81 0 : return false;
82 : }
83 :
84 :
85 : } } } // end of namespace ::sd::slidesorter::model
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|