LCOV - code coverage report
Current view: top level - oox/source/drawingml/chart - datasourcecontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 80 0.0 %
Date: 2014-04-14 Functions: 0 16 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 "oox/drawingml/chart/datasourcecontext.hxx"
      21             : 
      22             : #include "oox/drawingml/chart/datasourcemodel.hxx"
      23             : 
      24             : namespace oox {
      25             : namespace drawingml {
      26             : namespace chart {
      27             : 
      28             : 
      29             : 
      30             : using ::oox::core::ContextHandler2Helper;
      31             : using ::oox::core::ContextHandlerRef;
      32             : 
      33             : 
      34             : 
      35           0 : DoubleSequenceContext::DoubleSequenceContext( ContextHandler2Helper& rParent, DataSequenceModel& rModel ) :
      36             :     DataSequenceContextBase( rParent, rModel ),
      37           0 :     mnPtIndex( -1 )
      38             : {
      39           0 : }
      40             : 
      41           0 : DoubleSequenceContext::~DoubleSequenceContext()
      42             : {
      43           0 : }
      44             : 
      45           0 : ContextHandlerRef DoubleSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      46             : {
      47           0 :     switch( getCurrentElement() )
      48             :     {
      49             :         case C_TOKEN( numRef ):
      50           0 :             switch( nElement )
      51             :             {
      52             :                 case C_TOKEN( f ):
      53             :                 case C_TOKEN( numCache ):
      54           0 :                     return this;
      55             :             }
      56           0 :         break;
      57             : 
      58             :         case C_TOKEN( numCache ):
      59             :         case C_TOKEN( numLit ):
      60           0 :             switch( nElement )
      61             :             {
      62             :                 case C_TOKEN( formatCode ):
      63           0 :                     return this;
      64             :                 case C_TOKEN( ptCount ):
      65           0 :                     mrModel.mnPointCount = rAttribs.getInteger( XML_val, -1 );
      66           0 :                     return 0;
      67             :                 case C_TOKEN( pt ):
      68           0 :                     mnPtIndex = rAttribs.getInteger( XML_idx, -1 );
      69           0 :                     return this;
      70             :             }
      71           0 :         break;
      72             : 
      73             :         case C_TOKEN( pt ):
      74           0 :             switch( nElement )
      75             :             {
      76             :                 case C_TOKEN( v ):
      77           0 :                     return this;
      78             :             }
      79           0 :         break;
      80             :     }
      81           0 :     return 0;
      82             : }
      83             : 
      84           0 : void DoubleSequenceContext::onCharacters( const OUString& rChars )
      85             : {
      86           0 :     switch( getCurrentElement() )
      87             :     {
      88             :         case C_TOKEN( f ):
      89           0 :             mrModel.maFormula = rChars;
      90           0 :         break;
      91             :         case C_TOKEN( formatCode ):
      92           0 :             mrModel.maFormatCode = rChars;
      93           0 :         break;
      94             :         case C_TOKEN( v ):
      95           0 :             if( mnPtIndex >= 0 )
      96             :             {
      97             :                 /* Import categories as String even though it could
      98             :                  * be values.
      99             :                  * n#810508: xVal needs to be imported as double
     100             :                  * TODO: NumberFormat conversion, remove the check then.
     101             :                  */
     102           0 :                 if( isParentElement( C_TOKEN( cat ), 4 ) )
     103           0 :                     mrModel.maData[ mnPtIndex ] <<= rChars;
     104             :                 else
     105           0 :                     mrModel.maData[ mnPtIndex ] <<= rChars.toDouble();
     106             :             }
     107           0 :         break;
     108             :     }
     109           0 : }
     110             : 
     111             : 
     112             : 
     113           0 : StringSequenceContext::StringSequenceContext( ContextHandler2Helper& rParent, DataSequenceModel& rModel )
     114             :     : DataSequenceContextBase( rParent, rModel )
     115           0 :     , mnPtIndex(-1)
     116             : {
     117           0 : }
     118             : 
     119           0 : StringSequenceContext::~StringSequenceContext()
     120             : {
     121           0 : }
     122             : 
     123           0 : ContextHandlerRef StringSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     124             : {
     125           0 :     switch( getCurrentElement() )
     126             :     {
     127             :         case C_TOKEN( multiLvlStrRef ):
     128           0 :             switch( nElement )
     129             :             {
     130             :                 case C_TOKEN( f ):
     131           0 :                     return this;
     132             :             }
     133           0 :         break;
     134             : 
     135             :         case C_TOKEN( strRef ):
     136           0 :             switch( nElement )
     137             :             {
     138             :                 case C_TOKEN( f ):
     139             :                 case C_TOKEN( strCache ):
     140           0 :                     return this;
     141             :             }
     142           0 :         break;
     143             : 
     144             :         case C_TOKEN( strCache ):
     145             :         case C_TOKEN( strLit ):
     146           0 :             switch( nElement )
     147             :             {
     148             :                 case C_TOKEN( ptCount ):
     149           0 :                     mrModel.mnPointCount = rAttribs.getInteger( XML_val, -1 );
     150           0 :                     return 0;
     151             :                 case C_TOKEN( pt ):
     152           0 :                     mnPtIndex = rAttribs.getInteger( XML_idx, -1 );
     153           0 :                     return this;
     154             :             }
     155           0 :         break;
     156             : 
     157             :         case C_TOKEN( pt ):
     158           0 :             switch( nElement )
     159             :             {
     160             :                 case C_TOKEN( v ):
     161           0 :                     return this;
     162             :             }
     163           0 :         break;
     164             :     }
     165           0 :     return 0;
     166             : }
     167             : 
     168           0 : void StringSequenceContext::onCharacters( const OUString& rChars )
     169             : {
     170           0 :     switch( getCurrentElement() )
     171             :     {
     172             :         case C_TOKEN( f ):
     173           0 :             mrModel.maFormula = rChars;
     174           0 :         break;
     175             :         case C_TOKEN( v ):
     176           0 :             if( mnPtIndex >= 0 )
     177           0 :                 mrModel.maData[ mnPtIndex ] <<= rChars;
     178           0 :         break;
     179             :     }
     180           0 : }
     181             : 
     182             : 
     183             : 
     184           0 : DataSourceContext::DataSourceContext( ContextHandler2Helper& rParent, DataSourceModel& rModel ) :
     185           0 :     ContextBase< DataSourceModel >( rParent, rModel )
     186             : {
     187           0 : }
     188             : 
     189           0 : DataSourceContext::~DataSourceContext()
     190             : {
     191           0 : }
     192             : 
     193           0 : ContextHandlerRef DataSourceContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
     194             : {
     195           0 :     switch( getCurrentElement() )
     196             :     {
     197             :         case C_TOKEN( cat ):
     198             :         case C_TOKEN( xVal ):
     199           0 :             switch( nElement )
     200             :             {
     201             :                 case C_TOKEN( multiLvlStrRef ):
     202             :                 case C_TOKEN( strLit ):
     203             :                 case C_TOKEN( strRef ):
     204             :                     OSL_ENSURE( !mrModel.mxDataSeq, "DataSourceContext::onCreateContext - multiple data sequences" );
     205           0 :                     return new StringSequenceContext( *this, mrModel.mxDataSeq.create() );
     206             : 
     207             :                 case C_TOKEN( numLit ):
     208             :                 case C_TOKEN( numRef ):
     209             :                     OSL_ENSURE( !mrModel.mxDataSeq, "DataSourceContext::onCreateContext - multiple data sequences" );
     210           0 :                     return new DoubleSequenceContext( *this, mrModel.mxDataSeq.create() );
     211             :             }
     212           0 :         break;
     213             : 
     214             :         case C_TOKEN( plus ):
     215             :         case C_TOKEN( minus ):
     216             :         case C_TOKEN( val ):
     217             :         case C_TOKEN( yVal ):
     218             :         case C_TOKEN( bubbleSize ):
     219           0 :             switch( nElement )
     220             :             {
     221             :                 case C_TOKEN( numLit ):
     222             :                 case C_TOKEN( numRef ):
     223             :                     OSL_ENSURE( !mrModel.mxDataSeq, "DataSourceContext::onCreateContext - multiple data sequences" );
     224           0 :                     return new DoubleSequenceContext( *this, mrModel.mxDataSeq.create() );
     225             :             }
     226           0 :         break;
     227             :     }
     228           0 :     return 0;
     229             : }
     230             : 
     231             : 
     232             : 
     233             : } // namespace chart
     234             : } // namespace drawingml
     235           0 : } // namespace oox
     236             : 
     237             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10