LCOV - code coverage report
Current view: top level - chart2/source/model/template - ColumnLineDataInterpreter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 20 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 26 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 "ColumnLineDataInterpreter.hxx"
      22                 :            : #include "DataSeries.hxx"
      23                 :            : #include "macros.hxx"
      24                 :            : #include "DataSeriesHelper.hxx"
      25                 :            : #include "CommonConverters.hxx"
      26                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      27                 :            : #include <com/sun/star/chart2/data/XDataSink.hpp>
      28                 :            : 
      29                 :            : #include <vector>
      30                 :            : #include <algorithm>
      31                 :            : #include <iterator>
      32                 :            : 
      33                 :            : using namespace ::com::sun::star;
      34                 :            : using namespace ::com::sun::star::chart2;
      35                 :            : using namespace ::std;
      36                 :            : 
      37                 :            : using ::com::sun::star::uno::Reference;
      38                 :            : using ::com::sun::star::uno::Sequence;
      39                 :            : using ::rtl::OUString;
      40                 :            : 
      41                 :            : namespace chart
      42                 :            : {
      43                 :            : 
      44                 :            : // explicit
      45                 :          0 : ColumnLineDataInterpreter::ColumnLineDataInterpreter(
      46                 :            :     sal_Int32 nNumberOfLines,
      47                 :            :     const Reference< uno::XComponentContext > & xContext ) :
      48                 :            :         DataInterpreter( xContext ),
      49                 :          0 :         m_nNumberOfLines( nNumberOfLines )
      50                 :          0 : {}
      51                 :            : 
      52                 :          0 : ColumnLineDataInterpreter::~ColumnLineDataInterpreter()
      53         [ #  # ]:          0 : {}
      54                 :            : 
      55                 :            : // ____ XDataInterpreter ____
      56                 :          0 : InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource(
      57                 :            :     const Reference< data::XDataSource >& xSource,
      58                 :            :     const Sequence< beans::PropertyValue >& aArguments,
      59                 :            :     const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
      60                 :            :     throw (uno::RuntimeException)
      61                 :            : {
      62                 :          0 :     InterpretedData aResult(  DataInterpreter::interpretDataSource( xSource, aArguments, aSeriesToReUse ));
      63                 :            : 
      64                 :            :     // the base class should return one group
      65                 :            :     OSL_ASSERT( aResult.Series.getLength() == 1 );
      66         [ #  # ]:          0 :     if( aResult.Series.getLength() == 1 )
      67                 :            :     {
      68         [ #  # ]:          0 :         sal_Int32 nNumberOfSeries = aResult.Series[0].getLength();
      69                 :            : 
      70                 :            :         // if we have more than one series put the last nNumOfLines ones into a new group
      71 [ #  # ][ #  # ]:          0 :         if( nNumberOfSeries > 1 && m_nNumberOfLines > 0 )
      72                 :            :         {
      73         [ #  # ]:          0 :             sal_Int32 nNumOfLines = ::std::min( m_nNumberOfLines, nNumberOfSeries - 1 );
      74         [ #  # ]:          0 :             aResult.Series.realloc(2);
      75                 :            : 
      76         [ #  # ]:          0 :             Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0];
      77         [ #  # ]:          0 :             Sequence< Reference< XDataSeries > > & rLineDataSeries   = aResult.Series[1];
      78         [ #  # ]:          0 :             rLineDataSeries.realloc( nNumOfLines );
      79                 :          0 :             ::std::copy( rColumnDataSeries.getConstArray() + nNumberOfSeries - nNumOfLines,
      80                 :          0 :                          rColumnDataSeries.getConstArray() + nNumberOfSeries,
      81   [ #  #  #  # ]:          0 :                          rLineDataSeries.getArray() );
      82         [ #  # ]:          0 :             rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
      83                 :            :         }
      84                 :            :     }
      85                 :            : 
      86                 :          0 :     return aResult;
      87                 :            : }
      88                 :            : 
      89                 :            : } // namespace chart
      90                 :            : 
      91                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10