LCOV - code coverage report
Current view: top level - chart2/source/controller/itemsetwrapper - RegressionEquationItemConverter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 45 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 86 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                 :            : 
      20                 :            : 
      21                 :            : #include "RegressionEquationItemConverter.hxx"
      22                 :            : #include "SchWhichPairs.hxx"
      23                 :            : #include "macros.hxx"
      24                 :            : #include "ItemPropertyMap.hxx"
      25                 :            : #include "GraphicPropertyItemConverter.hxx"
      26                 :            : #include "CharacterPropertyItemConverter.hxx"
      27                 :            : #include "MultipleItemConverter.hxx"
      28                 :            : 
      29                 :            : #include <svl/intitem.hxx>
      30                 :            : #include <rtl/math.hxx>
      31                 :            : 
      32                 :            : #include <functional>
      33                 :            : #include <algorithm>
      34                 :            : 
      35                 :            : using namespace ::com::sun::star;
      36                 :            : 
      37                 :            : namespace
      38                 :            : {
      39                 :          0 : ::comphelper::ItemPropertyMapType & lcl_GetEquationPropertyMap()
      40                 :            : {
      41 [ #  # ][ #  # ]:          0 :     static ::comphelper::ItemPropertyMapType aEquationPropertyMap;
         [ #  # ][ #  # ]
      42                 :            : 
      43                 :          0 :     return aEquationPropertyMap;
      44                 :            : };
      45                 :            : } // anonymous namespace
      46                 :            : 
      47                 :            : namespace chart
      48                 :            : {
      49                 :            : namespace wrapper
      50                 :            : {
      51                 :            : 
      52                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
      53                 :          0 : RegressionEquationItemConverter::RegressionEquationItemConverter(
      54                 :            :     const ::com::sun::star::uno::Reference<
      55                 :            :     ::com::sun::star::beans::XPropertySet > & rPropertySet,
      56                 :            :     SfxItemPool& rItemPool,
      57                 :            :     SdrModel& rDrawModel,
      58                 :            :     const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
      59                 :            :     ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize ) :
      60         [ #  # ]:          0 :         ItemConverter( rPropertySet, rItemPool )
      61                 :            : {
      62                 :            :     m_aConverters.push_back( new GraphicPropertyItemConverter(
      63                 :            :                                  rPropertySet, rItemPool, rDrawModel,
      64                 :            :                                  xNamedPropertyContainerFactory,
      65 [ #  # ][ #  # ]:          0 :                                  GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ));
                 [ #  # ]
      66                 :            : 
      67                 :            :     m_aConverters.push_back( new CharacterPropertyItemConverter(
      68 [ #  # ][ #  # ]:          0 :                                  rPropertySet, rItemPool, pRefSize, C2U("ReferencePageSize")));
         [ #  # ][ #  # ]
      69                 :          0 : }
      70                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
      71                 :            : 
      72                 :          0 : RegressionEquationItemConverter::~RegressionEquationItemConverter()
      73                 :            : {
      74                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
      75         [ #  # ]:          0 :                      ::comphelper::DeleteItemConverterPtr() );
      76         [ #  # ]:          0 : }
      77                 :            : 
      78                 :          0 : void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
      79                 :            : {
      80                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
      81         [ #  # ]:          0 :                      ::comphelper::FillItemSetFunc( rOutItemSet ));
      82                 :            : 
      83                 :            :     // own items
      84                 :          0 :     ItemConverter::FillItemSet( rOutItemSet );
      85                 :          0 : }
      86                 :            : 
      87                 :          0 : bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
      88                 :            : {
      89                 :          0 :     bool bResult = false;
      90                 :            : 
      91                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
      92         [ #  # ]:          0 :                      ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
      93                 :            : 
      94                 :            :     // own items
      95 [ #  # ][ #  # ]:          0 :     return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
                 [ #  # ]
      96                 :            : }
      97                 :            : 
      98                 :          0 : const sal_uInt16 * RegressionEquationItemConverter::GetWhichPairs() const
      99                 :            : {
     100                 :            :     // must span all used items!
     101                 :          0 :     return nRegEquationWhichPairs;
     102                 :            : }
     103                 :            : 
     104                 :          0 : bool RegressionEquationItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
     105                 :            : {
     106         [ #  # ]:          0 :     ::comphelper::ItemPropertyMapType & rMap( lcl_GetEquationPropertyMap());
     107         [ #  # ]:          0 :     ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
     108                 :            : 
     109         [ #  # ]:          0 :     if( aIt == rMap.end())
     110                 :          0 :         return false;
     111                 :            : 
     112                 :          0 :     rOutProperty =(*aIt).second;
     113                 :          0 :     return true;
     114                 :            : }
     115                 :            : 
     116                 :          0 : bool RegressionEquationItemConverter::ApplySpecialItem(
     117                 :            :     sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
     118                 :            :     throw( uno::Exception )
     119                 :            : {
     120                 :          0 :     bool bChanged = false;
     121                 :            : 
     122         [ #  # ]:          0 :     switch( nWhichId )
     123                 :            :     {
     124                 :            :         case SID_ATTR_NUMBERFORMAT_VALUE:
     125                 :            :         {
     126                 :            :             uno::Any aValue( static_cast< sal_Int32 >(
     127                 :            :                 static_cast< const SfxUInt32Item & >(
     128 [ #  # ][ #  # ]:          0 :                     rItemSet.Get( nWhichId )).GetValue()));
     129 [ #  # ][ #  # ]:          0 :             if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
         [ #  # ][ #  # ]
                 [ #  # ]
     130                 :            :             {
     131 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
         [ #  # ][ #  # ]
     132                 :          0 :                 bChanged = true;
     133                 :          0 :             }
     134                 :            :         }
     135                 :          0 :         break;
     136                 :            :     }
     137                 :            : 
     138                 :          0 :     return bChanged;
     139                 :            : }
     140                 :            : 
     141                 :          0 : void RegressionEquationItemConverter::FillSpecialItem(
     142                 :            :     sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
     143                 :            :     throw( uno::Exception )
     144                 :            : {
     145         [ #  # ]:          0 :     switch( nWhichId )
     146                 :            :     {
     147                 :            :         case SID_ATTR_NUMBERFORMAT_VALUE:
     148                 :            :         {
     149                 :          0 :             sal_Int32 nFormatKey = 0;
     150 [ #  # ][ #  # ]:          0 :             if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nFormatKey )
         [ #  # ][ #  # ]
                 [ #  # ]
     151                 :            :             {
     152 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
                 [ #  # ]
     153                 :            :             }
     154                 :            :         }
     155                 :          0 :         break;
     156                 :            :    }
     157                 :          0 : }
     158                 :            : 
     159                 :            : } //  namespace wrapper
     160                 :            : } //  namespace chart
     161                 :            : 
     162                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10