LCOV - code coverage report
Current view: top level - vbahelper/source/vbahelper - vbafillformat.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 86 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 110 0.0 %

           Branch data     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                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      20                 :            : #include <com/sun/star/awt/Gradient.hpp>
      21                 :            : #include <com/sun/star/awt/GradientStyle.hpp>
      22                 :            : #include <ooo/vba/office/MsoGradientStyle.hpp>
      23                 :            : #include "vbafillformat.hxx"
      24                 :            : #include "vbacolorformat.hxx"
      25                 :            : 
      26                 :            : using namespace ooo::vba;
      27                 :            : using namespace com::sun::star;
      28                 :            : 
      29                 :          0 : ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape )
      30                 :            : {
      31         [ #  # ]:          0 :     m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
      32                 :          0 :     m_nFillStyle = drawing::FillStyle_SOLID;
      33                 :          0 :     m_nForeColor = 0;
      34                 :          0 :     m_nBackColor = 0;
      35                 :          0 :     m_nGradientAngle = 0;
      36                 :          0 : }
      37                 :            : 
      38                 :            : void
      39                 :          0 : ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException)
      40                 :            : {
      41                 :          0 :     m_nFillStyle = nFillStyle;
      42         [ #  # ]:          0 :     if( m_nFillStyle == drawing::FillStyle_GRADIENT )
      43                 :            :     {
      44 [ #  # ][ #  # ]:          0 :         m_xPropertySet->setPropertyValue( rtl::OUString("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) );
                 [ #  # ]
      45                 :          0 :         awt::Gradient aGradient;
      46                 :            :         // AXIAL
      47                 :            :         // RADIAL
      48                 :            :         // ELLIPTICAL
      49                 :            :         // SQUARE
      50                 :            :         // RECT
      51                 :          0 :         aGradient.Style = awt::GradientStyle_LINEAR;
      52 [ #  # ][ #  # ]:          0 :         aGradient.StartColor = ForeColor()->getRGB();
                 [ #  # ]
      53 [ #  # ][ #  # ]:          0 :         aGradient.EndColor = BackColor()->getRGB();
                 [ #  # ]
      54                 :          0 :         aGradient.Angle = m_nGradientAngle;
      55                 :          0 :         aGradient.Border = 0;
      56                 :          0 :         aGradient.XOffset = 0;
      57                 :          0 :         aGradient.YOffset = 0;
      58                 :          0 :         aGradient.StartIntensity = 100;
      59                 :          0 :         aGradient.EndIntensity = 100;
      60                 :          0 :         aGradient.StepCount = 1;
      61 [ #  # ][ #  # ]:          0 :         m_xPropertySet->setPropertyValue( rtl::OUString("FillGradient"), uno::makeAny( aGradient ) );
                 [ #  # ]
      62                 :            :     }
      63         [ #  # ]:          0 :     else if( m_nFillStyle == drawing::FillStyle_SOLID )
      64                 :            :     {
      65 [ #  # ][ #  # ]:          0 :         m_xPropertySet->setPropertyValue( rtl::OUString("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) );
      66                 :            :     }
      67                 :          0 : }
      68                 :            : 
      69                 :            : void
      70                 :          0 : ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException)
      71                 :            : {
      72                 :          0 :     m_nForeColor = nForeColor;
      73                 :          0 :     setFillStyle( m_nFillStyle );
      74                 :          0 : }
      75                 :            : 
      76                 :            : // Attributes
      77                 :            : sal_Bool SAL_CALL
      78                 :          0 : ScVbaFillFormat::getVisible() throw (uno::RuntimeException)
      79                 :            : {
      80                 :            :     drawing::FillStyle nFillStyle;
      81 [ #  # ][ #  # ]:          0 :     m_xPropertySet->getPropertyValue( rtl::OUString("FillStyle") ) >>= nFillStyle;
                 [ #  # ]
      82         [ #  # ]:          0 :     if( nFillStyle == drawing::FillStyle_NONE )
      83                 :          0 :         return sal_False;
      84                 :          0 :     return sal_True;
      85                 :            : }
      86                 :            : 
      87                 :            : void SAL_CALL
      88                 :          0 : ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
      89                 :            : {
      90                 :            :     drawing::FillStyle aFillStyle;
      91 [ #  # ][ #  # ]:          0 :     m_xPropertySet->getPropertyValue( rtl::OUString("FillStyle") ) >>= aFillStyle;
                 [ #  # ]
      92         [ #  # ]:          0 :     if( !_visible )
      93                 :            :     {
      94 [ #  # ][ #  # ]:          0 :         m_xPropertySet->setPropertyValue( rtl::OUString("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) );
                 [ #  # ]
      95                 :            :     }
      96                 :            :     else
      97                 :            :     {
      98         [ #  # ]:          0 :         if( aFillStyle == drawing::FillStyle_NONE )
      99                 :            :         {
     100         [ #  # ]:          0 :             setFillStyle( m_nFillStyle );
     101                 :            :         }
     102                 :            :     }
     103                 :          0 : }
     104                 :            : 
     105                 :            : double SAL_CALL
     106                 :          0 : ScVbaFillFormat::getTransparency() throw (uno::RuntimeException)
     107                 :            : {
     108                 :          0 :     sal_Int16 nTransparence = 0;
     109                 :          0 :     double dTransparence = 0;
     110 [ #  # ][ #  # ]:          0 :     m_xPropertySet->getPropertyValue( rtl::OUString("FillTransparence") ) >>= nTransparence;
     111                 :          0 :     dTransparence = static_cast<double>( nTransparence );
     112                 :          0 :     dTransparence /= 100;
     113                 :          0 :     return dTransparence;
     114                 :            : }
     115                 :            : 
     116                 :            : void SAL_CALL
     117                 :          0 : ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
     118                 :            : {
     119                 :          0 :     sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 );
     120 [ #  # ][ #  # ]:          0 :     m_xPropertySet->setPropertyValue( rtl::OUString("FillTransparence"), uno::makeAny( nTransparence ) );
                 [ #  # ]
     121                 :          0 : }
     122                 :            : 
     123                 :            : 
     124                 :            : // Methods
     125                 :            : void SAL_CALL
     126                 :          0 : ScVbaFillFormat::Solid() throw (uno::RuntimeException)
     127                 :            : {
     128                 :          0 :     setFillStyle( drawing::FillStyle_SOLID );
     129                 :          0 : }
     130                 :            : 
     131                 :            : void SAL_CALL
     132                 :          0 : ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException)
     133                 :            : {
     134         [ #  # ]:          0 :     if( style == office::MsoGradientStyle::msoGradientHorizontal )
     135                 :            :     {
     136                 :          0 :         m_nGradientAngle = 0;
     137                 :          0 :         setFillStyle( drawing::FillStyle_GRADIENT );
     138                 :            :     }
     139         [ #  # ]:          0 :     else if( style == office::MsoGradientStyle::msoGradientVertical )
     140                 :            :     {
     141                 :          0 :         m_nGradientAngle = 900;
     142                 :          0 :         setFillStyle( drawing::FillStyle_GRADIENT );
     143                 :            :     }
     144         [ #  # ]:          0 :     else if( style == office::MsoGradientStyle::msoGradientDiagonalDown )
     145                 :            :     {
     146                 :          0 :         m_nGradientAngle = 450;
     147                 :          0 :         setFillStyle( drawing::FillStyle_GRADIENT );
     148                 :            :     }
     149         [ #  # ]:          0 :     else if( style == office::MsoGradientStyle::msoGradientDiagonalUp )
     150                 :            :     {
     151                 :          0 :         m_nGradientAngle = 900 + 450;
     152                 :          0 :         setFillStyle( drawing::FillStyle_GRADIENT );
     153                 :            :     }
     154                 :          0 : }
     155                 :            : 
     156                 :            : uno::Reference< msforms::XColorFormat > SAL_CALL
     157                 :          0 : ScVbaFillFormat::BackColor() throw (uno::RuntimeException)
     158                 :            : {
     159         [ #  # ]:          0 :     if( !m_xColorFormat.is() )
     160 [ #  # ][ #  # ]:          0 :         m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) );
         [ #  # ][ #  # ]
     161                 :          0 :     return m_xColorFormat;
     162                 :            : }
     163                 :            : 
     164                 :            : uno::Reference< msforms::XColorFormat > SAL_CALL
     165                 :          0 : ScVbaFillFormat::ForeColor() throw (uno::RuntimeException)
     166                 :            : {
     167         [ #  # ]:          0 :     if( !m_xColorFormat.is() )
     168 [ #  # ][ #  # ]:          0 :         m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) );
         [ #  # ][ #  # ]
     169                 :          0 :     return m_xColorFormat;
     170                 :            : }
     171                 :            : 
     172                 :            : rtl::OUString
     173                 :          0 : ScVbaFillFormat::getServiceImplName()
     174                 :            : {
     175                 :          0 :     return rtl::OUString("ScVbaFillFormat");
     176                 :            : }
     177                 :            : 
     178                 :            : uno::Sequence< rtl::OUString >
     179                 :          0 : ScVbaFillFormat::getServiceNames()
     180                 :            : {
     181 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     182         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     183                 :            :     {
     184                 :          0 :         aServiceNames.realloc( 1 );
     185         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( "ooo.vba.msforms.FillFormat"  );
     186                 :            :     }
     187                 :          0 :     return aServiceNames;
     188                 :            : }
     189                 :            : 
     190                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10