LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/chart2/source/model/template - ColumnLineDataInterpreter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 20 0.0 %
Date: 2013-07-09 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             : 
      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             : 
      40             : namespace chart
      41             : {
      42             : 
      43             : // explicit
      44           0 : ColumnLineDataInterpreter::ColumnLineDataInterpreter(
      45             :     sal_Int32 nNumberOfLines,
      46             :     const Reference< uno::XComponentContext > & xContext ) :
      47             :         DataInterpreter( xContext ),
      48           0 :         m_nNumberOfLines( nNumberOfLines )
      49           0 : {}
      50             : 
      51           0 : ColumnLineDataInterpreter::~ColumnLineDataInterpreter()
      52           0 : {}
      53             : 
      54             : // ____ XDataInterpreter ____
      55           0 : InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource(
      56             :     const Reference< data::XDataSource >& xSource,
      57             :     const Sequence< beans::PropertyValue >& aArguments,
      58             :     const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
      59             :     throw (uno::RuntimeException)
      60             : {
      61           0 :     InterpretedData aResult(  DataInterpreter::interpretDataSource( xSource, aArguments, aSeriesToReUse ));
      62             : 
      63             :     // the base class should return one group
      64             :     OSL_ASSERT( aResult.Series.getLength() == 1 );
      65           0 :     if( aResult.Series.getLength() == 1 )
      66             :     {
      67           0 :         sal_Int32 nNumberOfSeries = aResult.Series[0].getLength();
      68             : 
      69             :         // if we have more than one series put the last nNumOfLines ones into a new group
      70           0 :         if( nNumberOfSeries > 1 && m_nNumberOfLines > 0 )
      71             :         {
      72           0 :             sal_Int32 nNumOfLines = ::std::min( m_nNumberOfLines, nNumberOfSeries - 1 );
      73           0 :             aResult.Series.realloc(2);
      74             : 
      75           0 :             Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0];
      76           0 :             Sequence< Reference< XDataSeries > > & rLineDataSeries   = aResult.Series[1];
      77           0 :             rLineDataSeries.realloc( nNumOfLines );
      78           0 :             ::std::copy( rColumnDataSeries.getConstArray() + nNumberOfSeries - nNumOfLines,
      79           0 :                          rColumnDataSeries.getConstArray() + nNumberOfSeries,
      80           0 :                          rLineDataSeries.getArray() );
      81           0 :             rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
      82             :         }
      83             :     }
      84             : 
      85           0 :     return aResult;
      86             : }
      87             : 
      88             : } // namespace chart
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10