LCOV - code coverage report
Current view: top level - chart2/source/controller/itemsetwrapper - RegressionEquationItemConverter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 45 0.0 %
Date: 2015-06-13 12:38:46 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             : #include <unonames.hxx>
      28             : 
      29             : #include <svl/intitem.hxx>
      30             : #include <rtl/math.hxx>
      31             : 
      32             : #include <functional>
      33             : #include <algorithm>
      34             : 
      35             : #include <boost/checked_delete.hpp>
      36             : 
      37             : using namespace ::com::sun::star;
      38             : 
      39             : namespace chart { namespace wrapper {
      40             : 
      41             : namespace {
      42             : 
      43           0 : ItemPropertyMapType & lcl_GetEquationPropertyMap()
      44             : {
      45           0 :     static ItemPropertyMapType aEquationPropertyMap;
      46             : 
      47           0 :     return aEquationPropertyMap;
      48             : };
      49             : 
      50             : } // anonymous namespace
      51             : 
      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             :     const 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(
      67           0 :         new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
      68           0 : }
      69             : 
      70           0 : RegressionEquationItemConverter::~RegressionEquationItemConverter()
      71             : {
      72           0 :     ::std::for_each(m_aConverters.begin(), m_aConverters.end(), boost::checked_deleter<ItemConverter>());
      73           0 : }
      74             : 
      75           0 : void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
      76             : {
      77             :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
      78           0 :                      FillItemSetFunc( rOutItemSet ));
      79             : 
      80             :     // own items
      81           0 :     ItemConverter::FillItemSet( rOutItemSet );
      82           0 : }
      83             : 
      84           0 : bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
      85             : {
      86           0 :     bool bResult = false;
      87             : 
      88             :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
      89           0 :                      ApplyItemSetFunc( rItemSet, bResult ));
      90             : 
      91             :     // own items
      92           0 :     return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
      93             : }
      94             : 
      95           0 : const sal_uInt16 * RegressionEquationItemConverter::GetWhichPairs() const
      96             : {
      97             :     // must span all used items!
      98           0 :     return nRegEquationWhichPairs;
      99             : }
     100             : 
     101           0 : bool RegressionEquationItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
     102             : {
     103           0 :     ItemPropertyMapType & rMap( lcl_GetEquationPropertyMap());
     104           0 :     ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
     105             : 
     106           0 :     if( aIt == rMap.end())
     107           0 :         return false;
     108             : 
     109           0 :     rOutProperty =(*aIt).second;
     110           0 :     return true;
     111             : }
     112             : 
     113           0 : bool RegressionEquationItemConverter::ApplySpecialItem(
     114             :     sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
     115             :     throw( uno::Exception )
     116             : {
     117           0 :     bool bChanged = false;
     118             : 
     119           0 :     switch( nWhichId )
     120             :     {
     121             :         case SID_ATTR_NUMBERFORMAT_VALUE:
     122             :         {
     123             :             uno::Any aValue( static_cast< sal_Int32 >(
     124             :                 static_cast< const SfxUInt32Item & >(
     125           0 :                     rItemSet.Get( nWhichId )).GetValue()));
     126           0 :             if (GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT) != aValue)
     127             :             {
     128           0 :                 GetPropertySet()->setPropertyValue(CHART_UNONAME_NUMFMT, aValue);
     129           0 :                 bChanged = true;
     130           0 :             }
     131             :         }
     132           0 :         break;
     133             :     }
     134             : 
     135           0 :     return bChanged;
     136             : }
     137             : 
     138           0 : void RegressionEquationItemConverter::FillSpecialItem(
     139             :     sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
     140             :     throw( uno::Exception )
     141             : {
     142           0 :     switch( nWhichId )
     143             :     {
     144             :         case SID_ATTR_NUMBERFORMAT_VALUE:
     145             :         {
     146           0 :             sal_Int32 nFormatKey = 0;
     147           0 :             if (GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormatKey)
     148             :             {
     149           0 :                 rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
     150             :             }
     151             :         }
     152           0 :         break;
     153             :    }
     154           0 : }
     155             : 
     156             : }}
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11