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

Generated by: LCOV version 1.10