LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/model - SlsVisualState.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 21 28 75.0 %
Date: 2014-11-03 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          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         146 : 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         146 :       mnLocationAnimationId(controller::Animator::NotAnAnimationId)
      33             : {
      34         146 : }
      35             : 
      36         146 : VisualState::~VisualState (void)
      37             : {
      38         146 :     if (mnStateAnimationId != controller::Animator::NotAnAnimationId
      39         146 :          || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
      40             :     {
      41             :         OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
      42             :         OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
      43             :     }
      44         146 : }
      45             : 
      46         661 : void VisualState::SetVisualState (const State eState)
      47             : {
      48         661 :     meOldVisualState = meCurrentVisualState;
      49         661 :     meCurrentVisualState = eState;
      50         661 : }
      51             : 
      52         661 : void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
      53             : {
      54         661 :     if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
      55           0 :         SetVisualState(VS_Excluded);
      56         661 :     else if (rDescriptor.HasState(PageDescriptor::ST_Current))
      57         385 :         SetVisualState(VS_Current);
      58         276 :     else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
      59           0 :         SetVisualState(VS_Focused);
      60         276 :     else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
      61         126 :         SetVisualState(VS_Selected);
      62             :     else
      63         150 :         SetVisualState(VS_None);
      64         661 : }
      65             : 
      66           0 : bool VisualState::SetLocationOffset (const Point& rOffset)
      67             : {
      68           0 :     if (maLocationOffset != rOffset)
      69             :     {
      70           0 :         maLocationOffset = rOffset;
      71           0 :         return true;
      72             :     }
      73             :     else
      74           0 :         return false;
      75             : }
      76             : 
      77         114 : } } } // end of namespace ::sd::slidesorter::model
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10