LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/view/main - VLineProperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 25 33 75.8 %
Date: 2012-12-27 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         287 : VLineProperties::VLineProperties()
      38             : {
      39         287 :     this->Color = uno::makeAny( sal_Int32(0x000000) ); //type sal_Int32 UNO_NAME_LINECOLOR
      40         287 :     this->LineStyle = uno::makeAny( drawing::LineStyle_SOLID ); //type drawing::LineStyle for property UNO_NAME_LINESTYLE
      41         287 :     this->Transparence = uno::makeAny( sal_Int16(0) );//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
      42         287 :     this->Width = uno::makeAny( sal_Int32(0) );//type sal_Int32 for property UNO_NAME_LINEWIDTH
      43         287 : }
      44             : 
      45         123 : void VLineProperties::initFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp, bool bUseSeriesPropertyNames )
      46             : {
      47         123 :     if(xProp.is())
      48             :     {
      49         123 :         if( bUseSeriesPropertyNames ) try
      50             :         {
      51           0 :             this->Color = xProp->getPropertyValue( C2U( "BorderColor" ) );
      52           0 :             this->LineStyle = xProp->getPropertyValue( C2U( "BorderStyle" ) );
      53           0 :             this->Transparence = xProp->getPropertyValue( C2U( "BorderTransparency" ) );
      54           0 :             this->Width = xProp->getPropertyValue( C2U( "BorderWidth" ) );
      55           0 :             this->DashName = xProp->getPropertyValue( C2U( "BorderDashName" ) );
      56             :         }
      57           0 :         catch( const uno::Exception& e )
      58             :         {
      59             :             ASSERT_EXCEPTION( e );
      60             :         }
      61             :         else try
      62             :         {
      63         123 :             this->Color = xProp->getPropertyValue( C2U( "LineColor" ) );
      64         123 :             this->LineStyle = xProp->getPropertyValue( C2U( "LineStyle" ) );
      65         123 :             this->Transparence = xProp->getPropertyValue( C2U( "LineTransparence" ) );
      66         123 :             this->Width = xProp->getPropertyValue( C2U( "LineWidth" ) );
      67         123 :             this->DashName = xProp->getPropertyValue( C2U( "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         123 : }
      77             : 
      78         164 : bool VLineProperties::isLineVisible() const
      79             : {
      80         164 :     bool bRet = false;
      81             : 
      82         164 :     drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
      83         164 :     this->LineStyle >>= aLineStyle;
      84         164 :     if( aLineStyle != drawing::LineStyle_NONE )
      85             :     {
      86          41 :         sal_Int16 nLineTransparence=0;
      87          41 :         this->Transparence >>= nLineTransparence;
      88          41 :         if(100!=nLineTransparence)
      89             :         {
      90          41 :             bRet = true;
      91             :         }
      92             :     }
      93             : 
      94         164 :     return bRet;
      95             : }
      96             : 
      97             : //.............................................................................
      98             : } //namespace chart
      99             : //.............................................................................
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10