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

Generated by: LCOV version 1.10