LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/chart2/source/view/main - VLineProperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 25 33 75.8 %
Date: 2013-07-09 Functions: 3 3 100.0 %
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             : 
      21             : #include "VLineProperties.hxx"
      22             : #include "macros.hxx"
      23             : #include <com/sun/star/drawing/LineStyle.hpp>
      24             : 
      25             : //.............................................................................
      26             : namespace chart
      27             : {
      28             : //.............................................................................
      29             : using namespace ::com::sun::star;
      30             : 
      31             : //-----------------------------------------------------------------------------
      32             : //-----------------------------------------------------------------------------
      33             : //  get line properties from a propertyset
      34             : //-----------------------------------------------------------------------------
      35             : //-----------------------------------------------------------------------------
      36             : 
      37        3968 : VLineProperties::VLineProperties()
      38             : {
      39        3968 :     this->Color = uno::makeAny( sal_Int32(0x000000) ); //type sal_Int32 UNO_NAME_LINECOLOR
      40        3968 :     this->LineStyle = uno::makeAny( drawing::LineStyle_SOLID ); //type drawing::LineStyle for property UNO_NAME_LINESTYLE
      41        3968 :     this->Transparence = uno::makeAny( sal_Int16(0) );//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
      42        3968 :     this->Width = uno::makeAny( sal_Int32(0) );//type sal_Int32 for property UNO_NAME_LINEWIDTH
      43        3968 : }
      44             : 
      45        1477 : void VLineProperties::initFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp, bool bUseSeriesPropertyNames )
      46             : {
      47        1477 :     if(xProp.is())
      48             :     {
      49        1477 :         if( bUseSeriesPropertyNames ) try
      50             :         {
      51           0 :             this->Color = xProp->getPropertyValue( "BorderColor" );
      52           0 :             this->LineStyle = xProp->getPropertyValue( "BorderStyle" );
      53           0 :             this->Transparence = xProp->getPropertyValue( "BorderTransparency" );
      54           0 :             this->Width = xProp->getPropertyValue( "BorderWidth" );
      55           0 :             this->DashName = xProp->getPropertyValue( "BorderDashName" );
      56             :         }
      57           0 :         catch( const uno::Exception& e )
      58             :         {
      59             :             ASSERT_EXCEPTION( e );
      60             :         }
      61             :         else try
      62             :         {
      63        1477 :             this->Color = xProp->getPropertyValue( "LineColor" );
      64        1477 :             this->LineStyle = xProp->getPropertyValue( "LineStyle" );
      65        1477 :             this->Transparence = xProp->getPropertyValue( "LineTransparence" );
      66        1477 :             this->Width = xProp->getPropertyValue( "LineWidth" );
      67        1477 :             this->DashName = xProp->getPropertyValue( "LineDashName" );
      68             :         }
      69           0 :         catch( const uno::Exception& e )
      70             :         {
      71             :             ASSERT_EXCEPTION( e );
      72             :         }
      73             :     }
      74             :     else
      75           0 :         this->LineStyle = uno::makeAny( drawing::LineStyle_NONE );
      76        1477 : }
      77             : 
      78        2088 : bool VLineProperties::isLineVisible() const
      79             : {
      80        2088 :     bool bRet = false;
      81             : 
      82        2088 :     drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
      83        2088 :     this->LineStyle >>= aLineStyle;
      84        2088 :     if( aLineStyle != drawing::LineStyle_NONE )
      85             :     {
      86         418 :         sal_Int16 nLineTransparence=0;
      87         418 :         this->Transparence >>= nLineTransparence;
      88         418 :         if(100!=nLineTransparence)
      89             :         {
      90         418 :             bRet = true;
      91             :         }
      92             :     }
      93             : 
      94        2088 :     return bRet;
      95             : }
      96             : 
      97             : //.............................................................................
      98             : } //namespace chart
      99             : //.............................................................................
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10