LCOV - code coverage report
Current view: top level - oox/source/drawingml/chart - datasourcecontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 81 1.2 %
Date: 2012-08-25 Functions: 2 16 12.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 71 2.8 %

           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                 :            : #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                 :            : using ::rtl::OUString;
      33                 :            : 
      34                 :            : // ============================================================================
      35                 :            : 
      36                 :          0 : DoubleSequenceContext::DoubleSequenceContext( ContextHandler2Helper& rParent, DataSequenceModel& rModel ) :
      37                 :            :     DataSequenceContextBase( rParent, rModel ),
      38                 :          0 :     mnPtIndex( -1 )
      39                 :            : {
      40                 :          0 : }
      41                 :            : 
      42                 :          0 : DoubleSequenceContext::~DoubleSequenceContext()
      43                 :            : {
      44         [ #  # ]:          0 : }
      45                 :            : 
      46                 :          0 : ContextHandlerRef DoubleSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      47                 :            : {
      48   [ #  #  #  # ]:          0 :     switch( getCurrentElement() )
      49                 :            :     {
      50                 :            :         case C_TOKEN( numRef ):
      51         [ #  # ]:          0 :             switch( nElement )
      52                 :            :             {
      53                 :            :                 case C_TOKEN( f ):
      54                 :            :                 case C_TOKEN( numCache ):
      55                 :          0 :                     return this;
      56                 :            :             }
      57                 :          0 :         break;
      58                 :            : 
      59                 :            :         case C_TOKEN( numCache ):
      60                 :            :         case C_TOKEN( numLit ):
      61   [ #  #  #  # ]:          0 :             switch( nElement )
      62                 :            :             {
      63                 :            :                 case C_TOKEN( formatCode ):
      64                 :          0 :                     return this;
      65                 :            :                 case C_TOKEN( ptCount ):
      66                 :          0 :                     mrModel.mnPointCount = rAttribs.getInteger( XML_val, -1 );
      67                 :          0 :                     return 0;
      68                 :            :                 case C_TOKEN( pt ):
      69                 :          0 :                     mnPtIndex = rAttribs.getInteger( XML_idx, -1 );
      70                 :          0 :                     return this;
      71                 :            :             }
      72                 :          0 :         break;
      73                 :            : 
      74                 :            :         case C_TOKEN( pt ):
      75         [ #  # ]:          0 :             switch( nElement )
      76                 :            :             {
      77                 :            :                 case C_TOKEN( v ):
      78                 :          0 :                     return this;
      79                 :            :             }
      80                 :          0 :         break;
      81                 :            :     }
      82                 :          0 :     return 0;
      83                 :            : }
      84                 :            : 
      85                 :          0 : void DoubleSequenceContext::onCharacters( const OUString& rChars )
      86                 :            : {
      87   [ #  #  #  # ]:          0 :     switch( getCurrentElement() )
      88                 :            :     {
      89                 :            :         case C_TOKEN( f ):
      90                 :          0 :             mrModel.maFormula = rChars;
      91                 :          0 :         break;
      92                 :            :         case C_TOKEN( formatCode ):
      93                 :          0 :             mrModel.maFormatCode = rChars;
      94                 :          0 :         break;
      95                 :            :         case C_TOKEN( v ):
      96         [ #  # ]:          0 :             if( mnPtIndex >= 0 )
      97                 :            :             {
      98                 :            :                 /* Import categories as String even though it could
      99                 :            :                  * be values.
     100                 :            :                  * TODO: NumberFormat conversion, remove the check then.
     101                 :            :                  */
     102   [ #  #  #  # ]:          0 :                 if( isParentElement( C_TOKEN( cat ), 4 ) ||
                 [ #  # ]
     103                 :          0 :                     isParentElement( C_TOKEN( xVal ), 4 ) )
     104                 :          0 :                     mrModel.maData[ mnPtIndex ] <<= rChars;
     105                 :            :                 else
     106 [ #  # ][ #  # ]:          0 :                     mrModel.maData[ mnPtIndex ] <<= rChars.toDouble();
     107                 :            :             }
     108                 :          0 :         break;
     109                 :            :     }
     110                 :          0 : }
     111                 :            : 
     112                 :            : // ============================================================================
     113                 :            : 
     114                 :          0 : StringSequenceContext::StringSequenceContext( ContextHandler2Helper& rParent, DataSequenceModel& rModel ) :
     115                 :          0 :     DataSequenceContextBase( rParent, rModel )
     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 [ +  - ][ +  - ]:        285 : } // namespace oox
     236                 :            : 
     237                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10