LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbainterior.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 28 193 14.5 %
Date: 2012-08-25 Functions: 3 29 10.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 42 356 11.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      29                 :            : #include <com/sun/star/table/XCell.hpp>
      30                 :            : #include <com/sun/star/table/XColumnRowRange.hpp>
      31                 :            : #include <com/sun/star/beans/XIntrospection.hpp>
      32                 :            : #include <com/sun/star/beans/XIntrospectionAccess.hpp>
      33                 :            : #include <com/sun/star/reflection/XIdlMethod.hpp>
      34                 :            : #include <com/sun/star/beans/MethodConcept.hpp>
      35                 :            : #include <com/sun/star/beans/NamedValue.hpp>
      36                 :            : #include <com/sun/star/xml/AttributeData.hpp>
      37                 :            : 
      38                 :            : #include <ooo/vba/excel/XlColorIndex.hpp>
      39                 :            : #include <ooo/vba/excel/XlPattern.hpp>
      40                 :            : 
      41                 :            : #include <comphelper/processfactory.hxx>
      42                 :            : #include <cppuhelper/queryinterface.hxx>
      43                 :            : 
      44                 :            : #include <map>
      45                 :            : 
      46                 :            : #include <sal/macros.h>
      47                 :            : #include <svx/xtable.hxx>
      48                 :            : 
      49                 :            : #include "vbainterior.hxx"
      50                 :            : #include "vbapalette.hxx"
      51                 :            : #include "document.hxx"
      52                 :            : 
      53                 :            : #define COLORMAST 0xFFFFFF
      54                 :            : const sal_uInt16 EXC_COLOR_WINDOWBACK = 65;
      55                 :            : typedef std::map< sal_Int32, sal_Int32 >  PatternMap;
      56                 :            : typedef std::pair< sal_Int32, sal_Int32 > PatternPair;
      57                 :            : using namespace ::com::sun::star;
      58                 :            : using namespace ::ooo::vba;
      59                 :            : using namespace ::ooo::vba::excel::XlPattern;
      60                 :          3 : static const rtl::OUString BACKCOLOR( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) );
      61                 :          3 : static const rtl::OUString PATTERN( RTL_CONSTASCII_USTRINGPARAM( "Pattern" ) );
      62                 :          3 : static const rtl::OUString PATTERNCOLOR( RTL_CONSTASCII_USTRINGPARAM( "PatternColor" ) );
      63                 :            : 
      64                 :          3 : PatternMap lcl_getPatternMap()
      65                 :            : {
      66                 :          3 :     PatternMap aPatternMap;
      67 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternAutomatic, 0 ) );
      68 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternChecker, 9 ) );
      69 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternCrissCross, 16 ) );
      70 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternDown, 7 ) );
      71 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGray16, 17 ) );
      72 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGray25, 4 ) );
      73 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGray50, 2 ) );
      74 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGray75, 3 ) );
      75 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGray8, 18 ) );
      76 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternGrid, 15 ) );
      77 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternHorizontal, 5 ) );
      78 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternLightDown, 13 ) );
      79 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternLightHorizontal, 11 ) );
      80 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternLightUp, 14 ) );
      81 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternLightVertical, 12 ) );
      82 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternNone, 0 ) );
      83 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternSemiGray75, 10 ) );
      84 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternSolid, 0 ) );
      85 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternUp, 8 ) );
      86 [ +  - ][ +  - ]:          3 :     aPatternMap.insert( PatternPair( xlPatternVertical, 6 ) );
      87                 :          3 :     return aPatternMap;
      88                 :            : }
      89                 :            : 
      90                 :          3 : static PatternMap aPatternMap( lcl_getPatternMap() );
      91                 :            : 
      92                 :          0 : ScVbaInterior::ScVbaInterior( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >&  xProps, ScDocument* pScDoc ) throw ( lang::IllegalArgumentException) : ScVbaInterior_BASE( xParent, xContext ), m_xProps(xProps), m_pScDoc( pScDoc )
      93                 :            : {
      94                 :            :     // auto color
      95                 :          0 :     m_aPattColor.SetColor( (sal_uInt32)0x0 );
      96                 :          0 :     m_nPattern = 0L;
      97         [ #  # ]:          0 :     if ( !m_xProps.is() )
      98 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "properties") ), uno::Reference< uno::XInterface >(), 2 );
      99                 :          0 : }
     100                 :            : 
     101                 :            : uno::Any
     102                 :          0 : ScVbaInterior::getColor() throw (uno::RuntimeException)
     103                 :            : {
     104         [ #  # ]:          0 :     Color aBackColor( GetBackColor() );
     105 [ #  # ][ #  # ]:          0 :     return uno::makeAny( OORGBToXLRGB( aBackColor.GetColor() ) );
     106                 :            : }
     107                 :            : 
     108                 :            : void
     109                 :          0 : ScVbaInterior::setColor( const uno::Any& _color  ) throw (uno::RuntimeException)
     110                 :            : {
     111                 :          0 :     sal_Int32 nColor = 0;
     112         [ #  # ]:          0 :     if( _color >>= nColor )
     113                 :            :     {
     114 [ #  # ][ #  # ]:          0 :         SetUserDefinedAttributes( BACKCOLOR, SetAttributeData( XLRGBToOORGB( nColor ) ) );
                 [ #  # ]
     115         [ #  # ]:          0 :         SetMixedColor();
     116                 :            :     }
     117                 :          0 : }
     118                 :            : 
     119                 :            : void
     120                 :          0 : ScVbaInterior::SetMixedColor()
     121                 :            : {
     122                 :            :     // pattern
     123         [ #  # ]:          0 :     uno::Any aPattern = GetUserDefinedAttributes( PATTERN );
     124         [ #  # ]:          0 :     if( aPattern.hasValue() )
     125                 :            :     {
     126         [ #  # ]:          0 :         m_nPattern = GetAttributeData( aPattern );
     127                 :            :     }
     128         [ #  # ]:          0 :     sal_Int32 nPattern = aPatternMap[ m_nPattern ];
     129                 :            :     // pattern color
     130         [ #  # ]:          0 :     uno::Any aPatternColor = GetUserDefinedAttributes( PATTERNCOLOR );
     131         [ #  # ]:          0 :     if( aPatternColor.hasValue() )
     132                 :            :     {
     133         [ #  # ]:          0 :         sal_uInt32 nPatternColor = GetAttributeData( aPatternColor );
     134                 :          0 :         m_aPattColor.SetColor( nPatternColor );
     135                 :            :     }
     136                 :          0 :     sal_Int32 nPatternColor = m_aPattColor.GetColor();
     137                 :            :     // back color
     138         [ #  # ]:          0 :     Color aBackColor( GetBackColor() );
     139                 :            :     // set mixed color
     140                 :          0 :     Color aMixedColor;
     141         [ #  # ]:          0 :     if( nPattern > 0 )
     142         [ #  # ]:          0 :         aMixedColor = GetPatternColor( Color(nPatternColor), aBackColor, (sal_uInt32)nPattern );
     143                 :            :     else
     144         [ #  # ]:          0 :         aMixedColor = GetPatternColor( aBackColor, aBackColor, (sal_uInt32)nPattern );
     145                 :          0 :     sal_Int32 nMixedColor = aMixedColor.GetColor() & COLORMAST;
     146 [ #  # ][ #  # ]:          0 :     m_xProps->setPropertyValue( BACKCOLOR , uno::makeAny( nMixedColor ) );
                 [ #  # ]
     147                 :          0 : }
     148                 :            : 
     149                 :            : uno::Reference< container::XIndexAccess >
     150                 :          0 : ScVbaInterior::getPalette()
     151                 :            : {
     152         [ #  # ]:          0 :     if ( !m_pScDoc )
     153         [ #  # ]:          0 :         throw uno::RuntimeException();
     154                 :          0 :     SfxObjectShell* pShell = m_pScDoc->GetDocumentShell();
     155                 :          0 :     ScVbaPalette aPalette( pShell );
     156         [ #  # ]:          0 :     return aPalette.getPalette();
     157                 :            : }
     158                 :            : 
     159                 :            : void SAL_CALL
     160                 :          0 : ScVbaInterior::setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException)
     161                 :            : {
     162                 :          0 :     sal_Int32 nIndex = 0;
     163                 :          0 :     _colorindex >>= nIndex;
     164                 :            : 
     165                 :            :     // hackly for excel::XlColorIndex::xlColorIndexNone
     166         [ #  # ]:          0 :     if( nIndex == excel::XlColorIndex::xlColorIndexNone )
     167                 :            :     {
     168 [ #  # ][ #  # ]:          0 :         m_xProps->setPropertyValue( BACKCOLOR, uno::makeAny( sal_Int32( -1 ) ) );
                 [ #  # ]
     169                 :            :     }
     170                 :            :     else
     171                 :            :     {
     172                 :            :         // setColor expects colors in XL RGB values
     173                 :            :         // #FIXME this is daft we convert OO RGB val to XL RGB val and
     174                 :            :         // then back again to OO RGB value
     175 [ #  # ][ #  # ]:          0 :         setColor( OORGBToXLRGB( GetIndexColor( nIndex ) ) );
                 [ #  # ]
     176                 :            :     }
     177                 :          0 : }
     178                 :            : uno::Any
     179                 :          0 : ScVbaInterior::GetIndexColor( const sal_Int32& nColorIndex )
     180                 :            : {
     181                 :          0 :     sal_Int32 nIndex = nColorIndex;
     182                 :            :     // #FIXME  xlColorIndexAutomatic & xlColorIndexNone are not really
     183                 :            :     // handled properly here
     184 [ #  # ][ #  # ]:          0 :     if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) || ( nIndex == excel::XlColorIndex::xlColorIndexNone )  )
                 [ #  # ]
     185                 :          0 :         nIndex = 2; // default is white ( this maybe will probably break, e.g. we may at some stage need to know what this interior is,  a cell or something else and then pick a default colour based on that )
     186                 :          0 :     --nIndex; // OOo indices are zero bases
     187         [ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xIndex = getPalette();
     188 [ #  # ][ #  # ]:          0 :     return xIndex->getByIndex( nIndex );
     189                 :            : }
     190                 :            : 
     191                 :            : sal_Int32
     192                 :          0 : ScVbaInterior::GetColorIndex( const sal_Int32 nColor )
     193                 :            : {
     194         [ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xIndex = getPalette();
     195 [ #  # ][ #  # ]:          0 :     sal_Int32 nElems = xIndex->getCount();
     196                 :          0 :     sal_Int32 nIndex = -1;
     197         [ #  # ]:          0 :     for ( sal_Int32 count=0; count<nElems; ++count )
     198                 :            :            {
     199                 :          0 :         sal_Int32 nPaletteColor = 0;
     200 [ #  # ][ #  # ]:          0 :         xIndex->getByIndex( count ) >>= nPaletteColor;
     201         [ #  # ]:          0 :         if ( nPaletteColor == nColor )
     202                 :            :         {
     203                 :          0 :             nIndex = count + 1; // 1 based
     204                 :            :             break;
     205                 :            :         }
     206                 :            :     }
     207                 :          0 :     return nIndex;
     208                 :            : }
     209                 :            : 
     210                 :            : uno::Any SAL_CALL
     211                 :          0 : ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException )
     212                 :            : {
     213                 :          0 :     sal_Int32 nColor = 0;
     214                 :            :     // hackly for excel::XlColorIndex::xlColorIndexNone
     215 [ #  # ][ #  # ]:          0 :     uno::Any aColor = m_xProps->getPropertyValue( BACKCOLOR );
     216 [ #  # ][ #  # ]:          0 :     if( ( aColor >>= nColor ) && ( nColor == -1 ) )
                 [ #  # ]
     217                 :            :     {
     218                 :          0 :         nColor = excel::XlColorIndex::xlColorIndexNone;
     219         [ #  # ]:          0 :         return uno::makeAny( nColor );
     220                 :            :     }
     221                 :            : 
     222                 :            :     // getColor returns Xl ColorValue, need to convert it to OO val
     223                 :            :     // as the palette deals with OO RGB values
     224                 :            :     // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val
     225                 :            :     // and then back again to OO RGB value
     226 [ #  # ][ #  # ]:          0 :     XLRGBToOORGB( getColor() ) >>= nColor;
     227                 :            : 
     228 [ #  # ][ #  # ]:          0 :     return uno::makeAny( GetColorIndex( nColor ) );
     229                 :            : }
     230                 :            : Color
     231                 :          0 : ScVbaInterior::GetPatternColor( const Color& rPattColor, const Color& rBackColor, sal_uInt32 nXclPattern )
     232                 :            : {
     233                 :            :     // 0x00 == 0% transparence (full rPattColor)
     234                 :            :     // 0x80 == 100% transparence (full rBackColor)
     235                 :            :     static const sal_uInt8 pnRatioTable[] =
     236                 :            :     {
     237                 :            :         0x80, 0x00, 0x40, 0x20, 0x60, 0x40, 0x40, 0x40,     // 00 - 07
     238                 :            :         0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48,     // 08 - 15
     239                 :            :         0x50, 0x70, 0x78                                    // 16 - 18
     240                 :            :     };
     241                 :            :     return ( nXclPattern < SAL_N_ELEMENTS( pnRatioTable ) ) ?
     242         [ #  # ]:          0 :         GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor;
     243                 :            : }
     244                 :            : Color
     245                 :          0 : ScVbaInterior::GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8 nTrans )
     246                 :            : {
     247                 :            :     return Color(
     248                 :            :         nTrans,
     249                 :          0 :         GetMixedColorComp( rFore.GetRed(), rBack.GetRed(), nTrans ),
     250                 :          0 :         GetMixedColorComp( rFore.GetGreen(), rBack.GetGreen(), nTrans ),
     251                 :          0 :         GetMixedColorComp( rFore.GetBlue(), rBack.GetBlue(), nTrans ));
     252                 :            : }
     253                 :            : sal_uInt8
     254                 :          0 : ScVbaInterior::GetMixedColorComp(  sal_uInt8 nFore, sal_uInt8 nBack, sal_uInt8 nTrans ) const
     255                 :            : {
     256                 :          0 :     sal_uInt32 nTemp = ((static_cast< sal_Int32 >( nBack ) - nFore) * nTrans) / 0x80 + nFore;
     257                 :          0 :     return static_cast< sal_uInt8 >( nTemp );
     258                 :            : }
     259                 :            : uno::Reference< container::XNameContainer >
     260                 :          0 : ScVbaInterior::GetAttributeContainer()
     261                 :            : {
     262 [ #  # ][ #  # ]:          0 :     return uno::Reference < container::XNameContainer > ( m_xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UserDefinedAttributes" )) ), uno::UNO_QUERY_THROW );
     263                 :            : }
     264                 :            : sal_Int32
     265                 :          0 : ScVbaInterior::GetAttributeData( uno::Any aValue )
     266                 :            : {
     267                 :          0 :     xml::AttributeData aDataValue;
     268 [ #  # ][ #  # ]:          0 :     if( aValue >>= aDataValue )
     269                 :            :     {
     270                 :          0 :         return aDataValue.Value.toInt32();
     271                 :            :     }
     272                 :          0 :     return sal_Int32( 0 );
     273                 :            : }
     274                 :            : uno::Any
     275                 :          0 : ScVbaInterior::SetAttributeData( sal_Int32 nValue )
     276                 :            : {
     277                 :          0 :     xml::AttributeData aAttributeData;
     278         [ #  # ]:          0 :     aAttributeData.Type = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "sal_Int32" ));
     279                 :          0 :     aAttributeData.Value = rtl::OUString::valueOf( nValue );
     280         [ #  # ]:          0 :     return uno::makeAny( aAttributeData );
     281                 :            : }
     282                 :            : uno::Any
     283                 :          0 : ScVbaInterior::GetUserDefinedAttributes( const rtl::OUString& sName )
     284                 :            : {
     285 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XNameContainer > xNameContainer( GetAttributeContainer(), uno::UNO_QUERY_THROW );
     286 [ #  # ][ #  # ]:          0 :     if( xNameContainer->hasByName( sName ) )
                 [ #  # ]
     287                 :            :     {
     288 [ #  # ][ #  # ]:          0 :         return xNameContainer->getByName( sName );
     289                 :            :     }
     290                 :          0 :     return uno::Any();
     291                 :            : }
     292                 :            : void
     293                 :          0 : ScVbaInterior::SetUserDefinedAttributes( const rtl::OUString& sName, const uno::Any& aValue )
     294                 :            : {
     295         [ #  # ]:          0 :     if( aValue.hasValue() )
     296                 :            :     {
     297 [ #  # ][ #  # ]:          0 :         uno::Reference< container::XNameContainer > xNameContainer( GetAttributeContainer(), uno::UNO_QUERY_THROW );
     298 [ #  # ][ #  # ]:          0 :         if( xNameContainer->hasByName( sName ) )
                 [ #  # ]
     299 [ #  # ][ #  # ]:          0 :             xNameContainer->removeByName( sName );
     300 [ #  # ][ #  # ]:          0 :         xNameContainer->insertByName( sName, aValue );
     301 [ #  # ][ #  # ]:          0 :         m_xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UserDefinedAttributes" )), uno::makeAny( xNameContainer ) );
         [ #  # ][ #  # ]
     302                 :            :     }
     303                 :          0 : }
     304                 :            : // OOo do not support below API
     305                 :            : uno::Any SAL_CALL
     306                 :          0 : ScVbaInterior::getPattern() throw (uno::RuntimeException)
     307                 :            : {
     308                 :            :     // XlPattern
     309         [ #  # ]:          0 :     uno::Any aPattern = GetUserDefinedAttributes( PATTERN );
     310         [ #  # ]:          0 :     if( aPattern.hasValue() )
     311 [ #  # ][ #  # ]:          0 :         return uno::makeAny( GetAttributeData( aPattern ) );
     312         [ #  # ]:          0 :     return uno::makeAny( excel::XlPattern::xlPatternNone );
     313                 :            : }
     314                 :            : void SAL_CALL
     315                 :          0 : ScVbaInterior::setPattern( const uno::Any& _pattern ) throw (uno::RuntimeException)
     316                 :            : {
     317         [ #  # ]:          0 :     if( _pattern >>= m_nPattern )
     318                 :            :     {
     319         [ #  # ]:          0 :         SetUserDefinedAttributes( PATTERN, SetAttributeData( m_nPattern ) );
     320                 :          0 :         SetMixedColor();
     321                 :            :     }
     322                 :            :     else
     323 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Pattern index" )), uno::Reference< uno::XInterface >() );
     324                 :          0 : }
     325                 :            : Color
     326                 :          0 : ScVbaInterior::GetBackColor()
     327                 :            : {
     328                 :          0 :     sal_Int32 nColor = 0;
     329                 :          0 :     Color aBackColor;
     330         [ #  # ]:          0 :     uno::Any aColor = GetUserDefinedAttributes( BACKCOLOR );
     331         [ #  # ]:          0 :     if( aColor.hasValue() )
     332                 :            :     {
     333         [ #  # ]:          0 :         nColor = GetAttributeData( aColor );
     334                 :          0 :         aBackColor.SetColor( nColor );
     335                 :            :     }
     336                 :            :     else
     337                 :            :     {
     338                 :          0 :         uno::Any aAny;
     339 [ #  # ][ #  # ]:          0 :         aAny = OORGBToXLRGB( m_xProps->getPropertyValue( BACKCOLOR ) );
                 [ #  # ]
     340         [ #  # ]:          0 :         if( aAny >>= nColor )
     341                 :            :         {
     342         [ #  # ]:          0 :             nColor = XLRGBToOORGB( nColor );
     343                 :          0 :             aBackColor.SetColor( nColor );
     344 [ #  # ][ #  # ]:          0 :             SetUserDefinedAttributes( BACKCOLOR, SetAttributeData( nColor ) );
     345                 :          0 :         }
     346                 :            :     }
     347                 :          0 :     return aBackColor;
     348                 :            : }
     349                 :            : uno::Any SAL_CALL
     350                 :          0 : ScVbaInterior::getPatternColor() throw (uno::RuntimeException)
     351                 :            : {
     352                 :            :     // 0 is the default color. no filled.
     353         [ #  # ]:          0 :     uno::Any aPatternColor = GetUserDefinedAttributes( PATTERNCOLOR );
     354         [ #  # ]:          0 :     if( aPatternColor.hasValue() )
     355                 :            :     {
     356         [ #  # ]:          0 :         sal_uInt32 nPatternColor = GetAttributeData( aPatternColor );
     357 [ #  # ][ #  # ]:          0 :         return uno::makeAny( OORGBToXLRGB( nPatternColor ) );
     358                 :            :     }
     359         [ #  # ]:          0 :     return uno::makeAny( sal_Int32( 0 ) );
     360                 :            : }
     361                 :            : void SAL_CALL
     362                 :          0 : ScVbaInterior::setPatternColor( const uno::Any& _patterncolor ) throw (uno::RuntimeException)
     363                 :            : {
     364                 :          0 :     sal_Int32 nPattColor = 0;
     365         [ #  # ]:          0 :     if( _patterncolor >>= nPattColor )
     366                 :            :     {
     367 [ #  # ][ #  # ]:          0 :         SetUserDefinedAttributes( PATTERNCOLOR, SetAttributeData( XLRGBToOORGB( nPattColor ) ) );
                 [ #  # ]
     368         [ #  # ]:          0 :         SetMixedColor();
     369                 :            :     }
     370                 :            :     else
     371 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Pattern Color" )), uno::Reference< uno::XInterface >() );
     372                 :          0 : }
     373                 :            : uno::Any SAL_CALL
     374                 :          0 : ScVbaInterior::getPatternColorIndex() throw (uno::RuntimeException)
     375                 :            : {
     376                 :          0 :     sal_Int32 nColor = 0;
     377 [ #  # ][ #  # ]:          0 :     XLRGBToOORGB( getPatternColor() ) >>= nColor;
     378                 :            : 
     379 [ #  # ][ #  # ]:          0 :     return uno::makeAny( GetIndexColor( nColor ) );
     380                 :            : }
     381                 :            : void SAL_CALL
     382                 :          0 : ScVbaInterior::setPatternColorIndex( const uno::Any& _patterncolorindex ) throw (uno::RuntimeException)
     383                 :            : {
     384                 :          0 :     sal_Int32 nColorIndex = 0;
     385         [ #  # ]:          0 :     if( _patterncolorindex >>= nColorIndex )
     386                 :            :     {
     387         [ #  # ]:          0 :         if( nColorIndex == 0 )
     388                 :          0 :             return;
     389                 :          0 :         sal_Int32 nPattColor = 0;
     390         [ #  # ]:          0 :         GetIndexColor( nColorIndex ) >>= nPattColor;
     391 [ #  # ][ #  # ]:          0 :         setPatternColor( uno::makeAny( OORGBToXLRGB( nPattColor ) ) );
                 [ #  # ]
     392                 :            :     }
     393                 :            :     else
     394 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Pattern Color" )), uno::Reference< uno::XInterface >() );
     395                 :            : }
     396                 :            : 
     397                 :            : rtl::OUString
     398                 :          0 : ScVbaInterior::getServiceImplName()
     399                 :            : {
     400                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaInterior"));
     401                 :            : }
     402                 :            : 
     403                 :            : uno::Sequence< rtl::OUString >
     404                 :          0 : ScVbaInterior::getServiceNames()
     405                 :            : {
     406 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     407         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     408                 :            :     {
     409                 :          0 :         aServiceNames.realloc( 1 );
     410         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Interior" ) );
     411                 :            :     }
     412                 :          0 :     return aServiceNames;
     413 [ +  - ][ +  - ]:          9 : }
     414                 :            : 
     415                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10