LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/model - SlsVisualState.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 28 75.0 %
Date: 2015-06-13 12:38:46 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          91 : 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          91 :       mnLocationAnimationId(controller::Animator::NotAnAnimationId)
      33             : {
      34          91 : }
      35             : 
      36          91 : VisualState::~VisualState()
      37             : {
      38          91 :     if (mnStateAnimationId != controller::Animator::NotAnAnimationId
      39          91 :          || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
      40             :     {
      41             :         OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
      42             :         OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
      43             :     }
      44          91 : }
      45             : 
      46         417 : void VisualState::SetVisualState (const State eState)
      47             : {
      48         417 :     meOldVisualState = meCurrentVisualState;
      49         417 :     meCurrentVisualState = eState;
      50         417 : }
      51             : 
      52         417 : void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
      53             : {
      54         417 :     if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
      55           0 :         SetVisualState(VS_Excluded);
      56         417 :     else if (rDescriptor.HasState(PageDescriptor::ST_Current))
      57         249 :         SetVisualState(VS_Current);
      58         168 :     else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
      59           0 :         SetVisualState(VS_Focused);
      60         168 :     else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
      61          71 :         SetVisualState(VS_Selected);
      62             :     else
      63          97 :         SetVisualState(VS_None);
      64         417 : }
      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          66 : } } } // end of namespace ::sd::slidesorter::model
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11