LCOV - code coverage report
Current view: top level - oox/source/drawingml/chart - typegroupcontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 152 188 80.9 %
Date: 2015-06-13 12:38:46 Functions: 34 38 89.5 %
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 "drawingml/chart/typegroupcontext.hxx"
      21             : 
      22             : #include "drawingml/chart/seriescontext.hxx"
      23             : #include "drawingml/chart/typegroupmodel.hxx"
      24             : 
      25             : namespace oox {
      26             : namespace drawingml {
      27             : namespace chart {
      28             : 
      29             : using ::oox::core::ContextHandler2Helper;
      30             : using ::oox::core::ContextHandlerRef;
      31             : 
      32           2 : UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
      33           2 :     ContextBase< UpDownBarsModel >( rParent, rModel )
      34             : {
      35           2 : }
      36             : 
      37           4 : UpDownBarsContext::~UpDownBarsContext()
      38             : {
      39           4 : }
      40             : 
      41           6 : ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      42             : {
      43           6 :     switch( getCurrentElement() )
      44             :     {
      45             :         case C_TOKEN( upDownBars ):
      46           6 :             switch( nElement )
      47             :             {
      48             :                 case C_TOKEN( downBars ):
      49           2 :                     return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
      50             :                 case C_TOKEN( gapWidth ):
      51           2 :                     mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
      52           2 :                     return 0;
      53             :                 case C_TOKEN( upBars ):
      54           2 :                     return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
      55             :             }
      56           0 :         break;
      57             :     }
      58           0 :     return 0;
      59             : }
      60             : 
      61           5 : AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
      62           5 :     TypeGroupContextBase( rParent, rModel )
      63             : {
      64           5 : }
      65             : 
      66          10 : AreaTypeGroupContext::~AreaTypeGroupContext()
      67             : {
      68          10 : }
      69             : 
      70          28 : ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      71             : {
      72          28 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
      73          28 :     if( isRootElement() ) switch( nElement )
      74             :     {
      75             :         case C_TOKEN( axId ):
      76          10 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
      77          10 :             return 0;
      78             :         case C_TOKEN( dLbls ):
      79           3 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
      80             :         case C_TOKEN( dropLines ):
      81           0 :             return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
      82             :         case C_TOKEN( gapDepth ):
      83           0 :             mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
      84           0 :             return 0;
      85             :         case C_TOKEN( grouping ):
      86           5 :             mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
      87           5 :             return 0;
      88             :         case C_TOKEN( ser ):
      89           7 :             return new AreaSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
      90             :         case C_TOKEN( varyColors ):
      91           3 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
      92           3 :             return 0;
      93             :     }
      94           0 :     return 0;
      95             : }
      96             : 
      97          91 : BarTypeGroupContext::BarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
      98          91 :     TypeGroupContextBase( rParent, rModel )
      99             : {
     100          91 : }
     101             : 
     102         182 : BarTypeGroupContext::~BarTypeGroupContext()
     103             : {
     104         182 : }
     105             : 
     106         875 : ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     107             : {
     108         875 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     109         875 :     if( isRootElement() ) switch( nElement )
     110             :     {
     111             :         case C_TOKEN( axId ):
     112         212 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     113         212 :             return 0;
     114             :         case C_TOKEN( barDir ):
     115          91 :             mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
     116          91 :             return 0;
     117             :         case C_TOKEN( dLbls ):
     118          48 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     119             :         case C_TOKEN( gapDepth ):
     120           1 :             mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
     121           1 :             return 0;
     122             :         case C_TOKEN( gapWidth ):
     123          83 :             mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
     124          83 :             return 0;
     125             :         case C_TOKEN( grouping ):
     126          91 :             mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
     127          91 :             return 0;
     128             :         case C_TOKEN( overlap ):
     129          41 :             mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
     130          41 :             return 0;
     131             :         case C_TOKEN( ser ):
     132         201 :             return new BarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     133             :         case C_TOKEN( serLines ):
     134           0 :             return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
     135             :         case C_TOKEN( shape ):
     136          30 :             mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
     137          30 :             return 0;
     138             :         case C_TOKEN( varyColors ):
     139          77 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     140          77 :             return 0;
     141             :     }
     142           0 :     return 0;
     143             : }
     144             : 
     145           2 : BubbleTypeGroupContext::BubbleTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     146           2 :     TypeGroupContextBase( rParent, rModel )
     147             : {
     148           2 : }
     149             : 
     150           4 : BubbleTypeGroupContext::~BubbleTypeGroupContext()
     151             : {
     152           4 : }
     153             : 
     154          16 : ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     155             : {
     156          16 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     157          16 :     if( isRootElement() ) switch( nElement )
     158             :     {
     159             :         case C_TOKEN( axId ):
     160           4 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     161           4 :             return 0;
     162             :         case C_TOKEN( bubble3D ):
     163           1 :             mrModel.mbBubble3d = rAttribs.getBool( XML_val, !bMSO2007Doc );
     164           1 :             return 0;
     165             :         case C_TOKEN( bubbleScale ):
     166           1 :             mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
     167           1 :             return 0;
     168             :         case C_TOKEN( dLbls ):
     169           1 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     170             :         case C_TOKEN( ser ):
     171           6 :             return new BubbleSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     172             :         case C_TOKEN( showNegBubbles ):
     173           1 :             mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, !bMSO2007Doc );
     174           1 :             return 0;
     175             :         case C_TOKEN( sizeRepresents ):
     176           0 :             mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
     177           0 :             return 0;
     178             :         case C_TOKEN( varyColors ):
     179           2 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     180           2 :             return 0;
     181             :     }
     182           0 :     return 0;
     183             : }
     184             : 
     185          31 : LineTypeGroupContext::LineTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     186          31 :     TypeGroupContextBase( rParent, rModel )
     187             : {
     188          31 : }
     189             : 
     190          62 : LineTypeGroupContext::~LineTypeGroupContext()
     191             : {
     192          62 : }
     193             : 
     194         242 : ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     195             : {
     196         242 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     197         242 :     if( isRootElement() ) switch( nElement )
     198             :     {
     199             :         case C_TOKEN( axId ):
     200          62 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     201          62 :             return 0;
     202             :         case C_TOKEN( dLbls ):
     203          17 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     204             :         case C_TOKEN( dropLines ):
     205           0 :             return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
     206             :         case C_TOKEN( gapDepth ):
     207           0 :             mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
     208           0 :             return 0;
     209             :         case C_TOKEN( grouping ):
     210          29 :             mrModel.mnGrouping = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_standard : XML_clustered );
     211          29 :             return 0;
     212             :         case C_TOKEN( hiLowLines ):
     213          13 :             return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
     214             :         case C_TOKEN( marker ):
     215          25 :             mrModel.mbShowMarker = rAttribs.getBool( XML_val, !bMSO2007Doc );
     216          25 :             return 0;
     217             :         case C_TOKEN( ser ):
     218          62 :             return new LineSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     219             :         case C_TOKEN( smooth ):
     220          16 :             mrModel.mbSmooth = rAttribs.getBool( XML_val, !bMSO2007Doc );
     221          16 :             return 0;
     222             :         case C_TOKEN( upDownBars ):
     223           2 :             return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
     224             :         case C_TOKEN( varyColors ):
     225          16 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     226          16 :             return 0;
     227             :     }
     228           0 :     return 0;
     229             : }
     230             : 
     231          23 : PieTypeGroupContext::PieTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     232          23 :     TypeGroupContextBase( rParent, rModel )
     233             : {
     234          23 : }
     235             : 
     236          46 : PieTypeGroupContext::~PieTypeGroupContext()
     237             : {
     238          46 : }
     239             : 
     240          79 : ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     241             : {
     242          79 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     243          79 :     if( isRootElement() ) switch( nElement )
     244             :     {
     245             :         case C_TOKEN( dLbls ):
     246          12 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     247             :         case C_TOKEN( firstSliceAng ):
     248          16 :             mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
     249          16 :             return 0;
     250             :         case C_TOKEN( gapWidth ):
     251           1 :             mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
     252           1 :             return 0;
     253             :         case C_TOKEN( holeSize ):
     254           4 :             mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
     255           4 :             return 0;
     256             :         case C_TOKEN( ofPieType ):
     257           1 :             mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
     258           1 :             return 0;
     259             :         case C_TOKEN( secondPieSize ):
     260           1 :             mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
     261           1 :             return 0;
     262             :         case C_TOKEN( ser ):
     263          24 :             return new PieSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     264             :         case C_TOKEN( serLines ):
     265           1 :             return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
     266             :         case C_TOKEN( splitPos ):
     267           0 :             mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
     268           0 :             return 0;
     269             :         case C_TOKEN( splitType ):
     270           0 :             mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
     271           0 :             return 0;
     272             :         case C_TOKEN( varyColors ):
     273          19 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     274          19 :             return 0;
     275             :     }
     276           0 :     return 0;
     277             : }
     278             : 
     279           2 : RadarTypeGroupContext::RadarTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     280           2 :     TypeGroupContextBase( rParent, rModel )
     281             : {
     282           2 : }
     283             : 
     284           4 : RadarTypeGroupContext::~RadarTypeGroupContext()
     285             : {
     286           4 : }
     287             : 
     288          12 : ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     289             : {
     290          12 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     291          12 :     if( isRootElement() ) switch( nElement )
     292             :     {
     293             :         case C_TOKEN( axId ):
     294           4 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     295           4 :             return 0;
     296             :         case C_TOKEN( dLbls ):
     297           1 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     298             :         case C_TOKEN( radarStyle ):
     299           2 :             mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
     300           2 :             return 0;
     301             :         case C_TOKEN( ser ):
     302           4 :             return new RadarSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     303             :         case C_TOKEN( varyColors ):
     304           1 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     305           1 :             return 0;
     306             :     }
     307           0 :     return 0;
     308             : }
     309             : 
     310          24 : ScatterTypeGroupContext::ScatterTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     311          24 :     TypeGroupContextBase( rParent, rModel )
     312             : {
     313          24 : }
     314             : 
     315          48 : ScatterTypeGroupContext::~ScatterTypeGroupContext()
     316             : {
     317          48 : }
     318             : 
     319         141 : ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     320             : {
     321         141 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     322         141 :     if( isRootElement() ) switch( nElement )
     323             :     {
     324             :         case C_TOKEN( axId ):
     325          48 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     326          48 :             return 0;
     327             :         case C_TOKEN( dLbls ):
     328          12 :             return new DataLabelsContext( *this, mrModel.mxLabels.create(bMSO2007Doc) );
     329             :         case C_TOKEN( scatterStyle ):
     330          24 :             mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
     331          24 :             return 0;
     332             :         case C_TOKEN( ser ):
     333          36 :             return new ScatterSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     334             :         case C_TOKEN( varyColors ):
     335          21 :             mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
     336          21 :             return 0;
     337             :     }
     338           0 :     return 0;
     339             : }
     340             : 
     341           0 : SurfaceTypeGroupContext::SurfaceTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
     342           0 :     TypeGroupContextBase( rParent, rModel )
     343             : {
     344           0 : }
     345             : 
     346           0 : SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
     347             : {
     348           0 : }
     349             : 
     350           0 : ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     351             : {
     352           0 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     353           0 :     if( isRootElement() ) switch( nElement )
     354             :     {
     355             :         case C_TOKEN( axId ):
     356           0 :             mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
     357           0 :             return 0;
     358             :         case C_TOKEN( ser ):
     359           0 :             return new SurfaceSeriesContext( *this, mrModel.maSeries.create(bMSO2007Doc) );
     360             :         case C_TOKEN( wireframe ):
     361           0 :             mrModel.mbWireframe = rAttribs.getBool( XML_val, !bMSO2007Doc );
     362           0 :             return 0;
     363             :     }
     364           0 :     return 0;
     365             : }
     366             : 
     367             : } // namespace chart
     368             : } // namespace drawingml
     369         246 : } // namespace oox
     370             : 
     371             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11