LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/model - SlsVisualState.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 22 29 75.9 %
Date: 2014-04-11 Functions: 5 6 83.3 %
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          73 : 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          73 :       mnLocationAnimationId(controller::Animator::NotAnAnimationId)
      33             : {
      34          73 : }
      35             : 
      36          73 : VisualState::~VisualState (void)
      37             : {
      38          73 :     if (mnStateAnimationId != controller::Animator::NotAnAnimationId
      39          73 :          || mnLocationAnimationId != controller::Animator::NotAnAnimationId)
      40             :     {
      41             :         OSL_ASSERT(mnStateAnimationId == controller::Animator::NotAnAnimationId);
      42             :         OSL_ASSERT(mnLocationAnimationId == controller::Animator::NotAnAnimationId);
      43             :     }
      44          73 : }
      45             : 
      46         471 : void VisualState::SetVisualState (const State eState)
      47             : {
      48         471 :     meOldVisualState = meCurrentVisualState;
      49         471 :     meCurrentVisualState = eState;
      50         471 : }
      51             : 
      52             : 
      53         471 : void VisualState::UpdateVisualState (const PageDescriptor& rDescriptor)
      54             : {
      55         471 :     if (rDescriptor.HasState(PageDescriptor::ST_Excluded))
      56           0 :         SetVisualState(VS_Excluded);
      57         471 :     else if (rDescriptor.HasState(PageDescriptor::ST_Current))
      58         266 :         SetVisualState(VS_Current);
      59         205 :     else if (rDescriptor.HasState(PageDescriptor::ST_Focused))
      60           0 :         SetVisualState(VS_Focused);
      61         205 :     else if (rDescriptor.HasState(PageDescriptor::ST_Selected))
      62          63 :         SetVisualState(VS_Selected);
      63             :     else
      64         142 :         SetVisualState(VS_None);
      65         471 : }
      66             : 
      67        1745 : Point VisualState::GetLocationOffset (void) const
      68             : {
      69        1745 :     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: */

Generated by: LCOV version 1.10