LCOV - code coverage report
Current view: top level - chart2/source/model/template - ChartTypeManager.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 250 0.0 %
Date: 2014-04-14 Functions: 0 13 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 "ChartTypeManager.hxx"
      21             : #include "macros.hxx"
      22             : #include "StackMode.hxx"
      23             : #include "ContainerHelper.hxx"
      24             : 
      25             : #include "CartesianCoordinateSystem.hxx"
      26             : 
      27             : #include "LineChartTypeTemplate.hxx"
      28             : #include "BarChartTypeTemplate.hxx"
      29             : #include "ColumnLineChartTypeTemplate.hxx"
      30             : #include "AreaChartTypeTemplate.hxx"
      31             : #include "PieChartTypeTemplate.hxx"
      32             : #include "ScatterChartTypeTemplate.hxx"
      33             : #include "StockChartTypeTemplate.hxx"
      34             : #include "NetChartTypeTemplate.hxx"
      35             : #include "BubbleChartTypeTemplate.hxx"
      36             : #include "GL3DBarChartTypeTemplate.hxx"
      37             : #include <cppuhelper/component_context.hxx>
      38             : #include <comphelper/InlineContainer.hxx>
      39             : #include <com/sun/star/container/XContentEnumerationAccess.hpp>
      40             : #include <com/sun/star/lang/XServiceName.hpp>
      41             : #include <com/sun/star/chart/ChartSolidType.hpp>
      42             : #include <com/sun/star/chart2/CurveStyle.hpp>
      43             : 
      44             : #include <algorithm>
      45             : #include <iterator>
      46             : #include <functional>
      47             : #include <o3tl/compat_functional.hxx>
      48             : 
      49             : using namespace ::com::sun::star;
      50             : 
      51             : using ::com::sun::star::uno::Sequence;
      52             : using ::com::sun::star::uno::Reference;
      53             : using ::com::sun::star::uno::Any;
      54             : using ::osl::MutexGuard;
      55             : 
      56             : namespace
      57             : {
      58             : 
      59             : enum TemplateId
      60             : {
      61             :     TEMPLATE_SYMBOL,
      62             :     TEMPLATE_STACKEDSYMBOL,
      63             :     TEMPLATE_PERCENTSTACKEDSYMBOL,
      64             :     TEMPLATE_LINE,
      65             :     TEMPLATE_STACKEDLINE,
      66             :     TEMPLATE_PERCENTSTACKEDLINE,
      67             :     TEMPLATE_LINESYMBOL,
      68             :     TEMPLATE_STACKEDLINESYMBOL,
      69             :     TEMPLATE_PERCENTSTACKEDLINESYMBOL,
      70             :     TEMPLATE_THREEDLINE,
      71             :     TEMPLATE_STACKEDTHREEDLINE,
      72             :     TEMPLATE_PERCENTSTACKEDTHREEDLINE,
      73             :     TEMPLATE_THREEDLINEDEEP,
      74             :     TEMPLATE_COLUMN,
      75             :     TEMPLATE_STACKEDCOLUMN,
      76             :     TEMPLATE_PERCENTSTACKEDCOLUMN,
      77             :     TEMPLATE_BAR,
      78             :     TEMPLATE_STACKEDBAR,
      79             :     TEMPLATE_PERCENTSTACKEDBAR,
      80             :     TEMPLATE_THREEDCOLUMNDEEP,
      81             :     TEMPLATE_THREEDCOLUMNFLAT,
      82             :     TEMPLATE_STACKEDTHREEDCOLUMNFLAT,
      83             :     TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT,
      84             :     TEMPLATE_THREEDBARDEEP,
      85             :     TEMPLATE_THREEDBARFLAT,
      86             :     TEMPLATE_STACKEDTHREEDBARFLAT,
      87             :     TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT,
      88             :     TEMPLATE_COLUMNWITHLINE,
      89             :     TEMPLATE_STACKEDCOLUMNWITHLINE,
      90             :     TEMPLATE_AREA,
      91             :     TEMPLATE_STACKEDAREA,
      92             :     TEMPLATE_PERCENTSTACKEDAREA,
      93             :     TEMPLATE_THREEDAREA,
      94             :     TEMPLATE_STACKEDTHREEDAREA,
      95             :     TEMPLATE_PERCENTSTACKEDTHREEDAREA,
      96             :     TEMPLATE_PIE,
      97             :     TEMPLATE_PIEALLEXPLODED,
      98             :     TEMPLATE_DONUT,
      99             :     TEMPLATE_DONUTALLEXPLODED,
     100             :     TEMPLATE_THREEDPIE,
     101             :     TEMPLATE_THREEDPIEALLEXPLODED,
     102             :     TEMPLATE_THREEDDONUT,
     103             :     TEMPLATE_THREEDDONUTALLEXPLODED,
     104             :     TEMPLATE_SCATTERLINESYMBOL,
     105             :     TEMPLATE_SCATTERLINE,
     106             :     TEMPLATE_SCATTERSYMBOL,
     107             :     TEMPLATE_THREEDSCATTER,
     108             :     TEMPLATE_NET,
     109             :     TEMPLATE_NETSYMBOL,
     110             :     TEMPLATE_NETLINE,
     111             :     TEMPLATE_STACKEDNET,
     112             :     TEMPLATE_STACKEDNETSYMBOL,
     113             :     TEMPLATE_STACKEDNETLINE,
     114             :     TEMPLATE_PERCENTSTACKEDNET,
     115             :     TEMPLATE_PERCENTSTACKEDNETSYMBOL,
     116             :     TEMPLATE_PERCENTSTACKEDNETLINE,
     117             :     TEMPLATE_FILLEDNET,
     118             :     TEMPLATE_STACKEDFILLEDNET,
     119             :     TEMPLATE_PERCENTSTACKEDFILLEDNET,
     120             :     TEMPLATE_STOCKLOWHIGHCLOSE,
     121             :     TEMPLATE_STOCKOPENLOWHIGHCLOSE,
     122             :     TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
     123             :     TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
     124             :     TEMPLATE_BUBBLE,
     125             :     TEMPLATE_GL3DBAR,
     126             :     TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE,
     127             : //    TEMPLATE_SURFACE,
     128             : //     TEMPLATE_ADDIN,
     129             :     TEMPLATE_NOT_FOUND = 0xffff
     130             : };
     131             : 
     132             : typedef ::std::map< OUString, TemplateId > tTemplateMapType;
     133             : 
     134           0 : const tTemplateMapType & lcl_DefaultChartTypeMap()
     135             : {
     136             :     static const tTemplateMapType aMap = tTemplateMapType(
     137             :         ::comphelper::MakeMap< tTemplateMapType::key_type, tTemplateMapType::mapped_type >
     138             :         ( "com.sun.star.chart2.template.Symbol",                         TEMPLATE_SYMBOL )
     139           0 :         ( "com.sun.star.chart2.template.StackedSymbol",                  TEMPLATE_STACKEDSYMBOL )
     140           0 :         ( "com.sun.star.chart2.template.PercentStackedSymbol",           TEMPLATE_PERCENTSTACKEDSYMBOL )
     141           0 :         ( "com.sun.star.chart2.template.Line",                           TEMPLATE_LINE )
     142           0 :         ( "com.sun.star.chart2.template.StackedLine",                    TEMPLATE_STACKEDLINE )
     143           0 :         ( "com.sun.star.chart2.template.PercentStackedLine",             TEMPLATE_PERCENTSTACKEDLINE )
     144           0 :         ( "com.sun.star.chart2.template.LineSymbol",                     TEMPLATE_LINESYMBOL )
     145           0 :         ( "com.sun.star.chart2.template.StackedLineSymbol",              TEMPLATE_STACKEDLINESYMBOL )
     146           0 :         ( "com.sun.star.chart2.template.PercentStackedLineSymbol",       TEMPLATE_PERCENTSTACKEDLINESYMBOL )
     147           0 :         ( "com.sun.star.chart2.template.ThreeDLine",                     TEMPLATE_THREEDLINE )
     148           0 :         ( "com.sun.star.chart2.template.StackedThreeDLine",              TEMPLATE_STACKEDTHREEDLINE )
     149           0 :         ( "com.sun.star.chart2.template.PercentStackedThreeDLine",       TEMPLATE_PERCENTSTACKEDTHREEDLINE )
     150           0 :         ( "com.sun.star.chart2.template.ThreeDLineDeep",                 TEMPLATE_THREEDLINEDEEP )
     151           0 :         ( "com.sun.star.chart2.template.Column",                         TEMPLATE_COLUMN )
     152           0 :         ( "com.sun.star.chart2.template.StackedColumn",                  TEMPLATE_STACKEDCOLUMN )
     153           0 :         ( "com.sun.star.chart2.template.PercentStackedColumn",           TEMPLATE_PERCENTSTACKEDCOLUMN )
     154           0 :         ( "com.sun.star.chart2.template.Bar",                            TEMPLATE_BAR )
     155           0 :         ( "com.sun.star.chart2.template.StackedBar",                     TEMPLATE_STACKEDBAR )
     156           0 :         ( "com.sun.star.chart2.template.PercentStackedBar",              TEMPLATE_PERCENTSTACKEDBAR )
     157           0 :         ( "com.sun.star.chart2.template.ThreeDColumnDeep",               TEMPLATE_THREEDCOLUMNDEEP )
     158           0 :         ( "com.sun.star.chart2.template.ThreeDColumnFlat",               TEMPLATE_THREEDCOLUMNFLAT )
     159           0 :         ( "com.sun.star.chart2.template.StackedThreeDColumnFlat",        TEMPLATE_STACKEDTHREEDCOLUMNFLAT )
     160           0 :         ( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat", TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT )
     161           0 :         ( "com.sun.star.chart2.template.ThreeDBarDeep",                  TEMPLATE_THREEDBARDEEP )
     162           0 :         ( "com.sun.star.chart2.template.ThreeDBarFlat",                  TEMPLATE_THREEDBARFLAT )
     163           0 :         ( "com.sun.star.chart2.template.StackedThreeDBarFlat",           TEMPLATE_STACKEDTHREEDBARFLAT )
     164           0 :         ( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat",    TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT )
     165           0 :         ( "com.sun.star.chart2.template.ColumnWithLine",                 TEMPLATE_COLUMNWITHLINE )
     166           0 :         ( "com.sun.star.chart2.template.StackedColumnWithLine",          TEMPLATE_STACKEDCOLUMNWITHLINE )
     167           0 :         ( "com.sun.star.chart2.template.Area",                           TEMPLATE_AREA )
     168           0 :         ( "com.sun.star.chart2.template.StackedArea",                    TEMPLATE_STACKEDAREA )
     169           0 :         ( "com.sun.star.chart2.template.PercentStackedArea",             TEMPLATE_PERCENTSTACKEDAREA )
     170           0 :         ( "com.sun.star.chart2.template.ThreeDArea",                     TEMPLATE_THREEDAREA )
     171           0 :         ( "com.sun.star.chart2.template.StackedThreeDArea",              TEMPLATE_STACKEDTHREEDAREA )
     172           0 :         ( "com.sun.star.chart2.template.PercentStackedThreeDArea",       TEMPLATE_PERCENTSTACKEDTHREEDAREA )
     173           0 :         ( "com.sun.star.chart2.template.Pie",                            TEMPLATE_PIE )
     174           0 :         ( "com.sun.star.chart2.template.PieAllExploded",                 TEMPLATE_PIEALLEXPLODED )
     175           0 :         ( "com.sun.star.chart2.template.Donut",                          TEMPLATE_DONUT )
     176           0 :         ( "com.sun.star.chart2.template.DonutAllExploded",               TEMPLATE_DONUTALLEXPLODED )
     177           0 :         ( "com.sun.star.chart2.template.ThreeDPie",                      TEMPLATE_THREEDPIE )
     178           0 :         ( "com.sun.star.chart2.template.ThreeDPieAllExploded",           TEMPLATE_THREEDPIEALLEXPLODED )
     179           0 :         ( "com.sun.star.chart2.template.ThreeDDonut",                    TEMPLATE_THREEDDONUT )
     180           0 :         ( "com.sun.star.chart2.template.ThreeDDonutAllExploded",         TEMPLATE_THREEDDONUTALLEXPLODED )
     181           0 :         ( "com.sun.star.chart2.template.ScatterLineSymbol",              TEMPLATE_SCATTERLINESYMBOL )
     182           0 :         ( "com.sun.star.chart2.template.ScatterLine",                    TEMPLATE_SCATTERLINE )
     183           0 :         ( "com.sun.star.chart2.template.ScatterSymbol",                  TEMPLATE_SCATTERSYMBOL )
     184           0 :         ( "com.sun.star.chart2.template.ThreeDScatter",                  TEMPLATE_THREEDSCATTER )
     185           0 :         ( "com.sun.star.chart2.template.Net",                            TEMPLATE_NET )
     186           0 :         ( "com.sun.star.chart2.template.NetSymbol",                      TEMPLATE_NETSYMBOL )
     187           0 :         ( "com.sun.star.chart2.template.NetLine",                        TEMPLATE_NETLINE )
     188           0 :         ( "com.sun.star.chart2.template.StackedNet",                     TEMPLATE_STACKEDNET )
     189           0 :         ( "com.sun.star.chart2.template.StackedNetSymbol",               TEMPLATE_STACKEDNETSYMBOL )
     190           0 :         ( "com.sun.star.chart2.template.StackedNetLine",                 TEMPLATE_STACKEDNETLINE )
     191           0 :         ( "com.sun.star.chart2.template.PercentStackedNet",              TEMPLATE_PERCENTSTACKEDNET )
     192           0 :         ( "com.sun.star.chart2.template.PercentStackedNetSymbol",        TEMPLATE_PERCENTSTACKEDNETSYMBOL )
     193           0 :         ( "com.sun.star.chart2.template.PercentStackedNetLine",          TEMPLATE_PERCENTSTACKEDNETLINE )
     194           0 :         ( "com.sun.star.chart2.template.FilledNet",                      TEMPLATE_FILLEDNET )
     195           0 :         ( "com.sun.star.chart2.template.StackedFilledNet",               TEMPLATE_STACKEDFILLEDNET )
     196           0 :         ( "com.sun.star.chart2.template.PercentStackedFilledNet",        TEMPLATE_PERCENTSTACKEDFILLEDNET )
     197           0 :         ( "com.sun.star.chart2.template.StockLowHighClose",              TEMPLATE_STOCKLOWHIGHCLOSE )
     198           0 :         ( "com.sun.star.chart2.template.StockOpenLowHighClose",          TEMPLATE_STOCKOPENLOWHIGHCLOSE )
     199           0 :         ( "com.sun.star.chart2.template.StockVolumeLowHighClose",        TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
     200           0 :         ( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose",    TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
     201           0 :         ( "com.sun.star.chart2.template.Bubble",                         TEMPLATE_BUBBLE )
     202           0 :         ( "com.sun.star.chart2.template.GL3DBar",                        TEMPLATE_GL3DBAR )
     203           0 :         ( "com.sun.star.chart2.template.GL3DBarRoundedRectangle",        TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE )
     204             : //      ( "com.sun.star.chart2.template.Surface",                        TEMPLATE_SURFACE )
     205             : //      ( "com.sun.star.chart2.template.Addin",                          TEMPLATE_ADDIN )
     206           0 :         );
     207             : 
     208           0 :     return aMap;
     209             : }
     210             : 
     211           0 : TemplateId lcl_GetTemplateIdForService( const OUString & rServiceName )
     212             : {
     213           0 :     TemplateId eResult = TEMPLATE_NOT_FOUND;
     214           0 :     const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
     215           0 :     tTemplateMapType::const_iterator aIt( rMap.find( rServiceName ));
     216             : 
     217           0 :     if( aIt != rMap.end())
     218           0 :         eResult = (*aIt).second;
     219             : 
     220           0 :     return eResult;
     221             : }
     222             : 
     223             : } // anonymous namespace
     224             : 
     225             : namespace chart
     226             : {
     227             : 
     228           0 : ChartTypeManager::ChartTypeManager(
     229             :     uno::Reference<
     230             :         uno::XComponentContext > const & xContext ) :
     231           0 :     m_xContext( xContext )
     232           0 : {}
     233             : 
     234           0 : ChartTypeManager::~ChartTypeManager()
     235           0 : {}
     236             : 
     237             : // ____ XMultiServiceFactory ____
     238           0 : uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
     239             :     const OUString& aServiceSpecifier )
     240             :     throw (uno::Exception,
     241             :            uno::RuntimeException, std::exception)
     242             : {
     243           0 :     uno::Reference< uno::XInterface > xResult;
     244           0 :     TemplateId nId = lcl_GetTemplateIdForService( aServiceSpecifier );
     245             : 
     246           0 :     if( nId == TEMPLATE_NOT_FOUND )
     247             :     {
     248             :         try
     249             :         {
     250           0 :             xResult = m_xContext->getServiceManager()->createInstanceWithContext(
     251           0 :                 aServiceSpecifier, m_xContext );
     252             :         }
     253             : //         catch( registry::InvalidValueException & ex )
     254           0 :         catch( const uno::Exception & ex )
     255             :         {
     256             :             // couldn't create service via factory
     257             : 
     258             :             // As XMultiServiceFactory does not specify, what to do in case
     259             :             // createInstance is called with an unknown service-name, this
     260             :             // function will just return an empty XInterface.
     261             :             ASSERT_EXCEPTION( ex );
     262             :             SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier );
     263           0 :             xResult.set( 0 );
     264             :         }
     265             :     }
     266             :     else
     267             :     {
     268           0 :         uno::Reference< chart2::XChartTypeTemplate > xTemplate;
     269           0 :         switch( nId )
     270             :         {
     271             :             // Point (category x axis)
     272             :             case TEMPLATE_SYMBOL:
     273             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     274           0 :                     StackMode_NONE, true, false ));
     275           0 :                 break;
     276             :             case TEMPLATE_STACKEDSYMBOL:
     277             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     278           0 :                     StackMode_Y_STACKED, true, false ));
     279           0 :                 break;
     280             :             case TEMPLATE_PERCENTSTACKEDSYMBOL:
     281             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     282           0 :                     StackMode_Y_STACKED_PERCENT, true, false ));
     283           0 :                 break;
     284             :             // Line (category x axis)
     285             :             case TEMPLATE_LINE:
     286             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     287           0 :                     StackMode_NONE, false ));
     288           0 :                 break;
     289             :             case TEMPLATE_STACKEDLINE:
     290             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     291           0 :                     StackMode_Y_STACKED, false ));
     292           0 :                 break;
     293             :             case TEMPLATE_PERCENTSTACKEDLINE:
     294             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     295           0 :                     StackMode_Y_STACKED_PERCENT, false ));
     296           0 :                 break;
     297             :             case TEMPLATE_LINESYMBOL:
     298             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     299           0 :                     StackMode_NONE, true ));
     300           0 :                 break;
     301             :             case TEMPLATE_STACKEDLINESYMBOL:
     302             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     303           0 :                     StackMode_Y_STACKED, true ));
     304           0 :                 break;
     305             :             case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
     306             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     307           0 :                     StackMode_Y_STACKED_PERCENT, true ));
     308           0 :                 break;
     309             :             case TEMPLATE_THREEDLINE:
     310             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     311           0 :                     StackMode_NONE, false, true, 3 ));
     312           0 :                 break;
     313             :             case TEMPLATE_STACKEDTHREEDLINE:
     314             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     315           0 :                     StackMode_Y_STACKED, false, true, 3 ));
     316           0 :                 break;
     317             :             case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
     318             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     319           0 :                     StackMode_Y_STACKED_PERCENT, false, true, 3 ));
     320           0 :                 break;
     321             :             case TEMPLATE_THREEDLINEDEEP:
     322             :                 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
     323           0 :                     StackMode_Z_STACKED, false, true, 3 ));
     324           0 :                 break;
     325             : 
     326             :             // Bar/Column
     327             :             case TEMPLATE_COLUMN:
     328             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     329           0 :                     StackMode_NONE, BarChartTypeTemplate::VERTICAL ));
     330           0 :                 break;
     331             :             case TEMPLATE_STACKEDCOLUMN:
     332             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     333           0 :                     StackMode_Y_STACKED, BarChartTypeTemplate::VERTICAL ));
     334           0 :                 break;
     335             :             case TEMPLATE_PERCENTSTACKEDCOLUMN:
     336             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     337           0 :                     StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::VERTICAL ));
     338           0 :                 break;
     339             :             case TEMPLATE_BAR:
     340             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     341           0 :                     StackMode_NONE, BarChartTypeTemplate::HORIZONTAL ));
     342           0 :                 break;
     343             :             case TEMPLATE_STACKEDBAR:
     344             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     345           0 :                     StackMode_Y_STACKED, BarChartTypeTemplate::HORIZONTAL ));
     346           0 :                 break;
     347             :             case TEMPLATE_PERCENTSTACKEDBAR:
     348             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     349           0 :                     StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::HORIZONTAL ));
     350           0 :                 break;
     351             :             case TEMPLATE_THREEDCOLUMNDEEP:
     352             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     353           0 :                     StackMode_Z_STACKED, BarChartTypeTemplate::VERTICAL, 3 ));
     354           0 :                 break;
     355             :             case TEMPLATE_THREEDCOLUMNFLAT:
     356             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     357           0 :                     StackMode_NONE, BarChartTypeTemplate::VERTICAL, 3 ));
     358           0 :                 break;
     359             :             case TEMPLATE_STACKEDTHREEDCOLUMNFLAT:
     360             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     361           0 :                     StackMode_Y_STACKED, BarChartTypeTemplate::VERTICAL, 3 ));
     362           0 :                 break;
     363             :             case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
     364             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     365           0 :                     StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::VERTICAL, 3 ));
     366           0 :                 break;
     367             :             case TEMPLATE_THREEDBARDEEP:
     368             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     369           0 :                     StackMode_Z_STACKED, BarChartTypeTemplate::HORIZONTAL, 3 ));
     370           0 :                 break;
     371             :             case TEMPLATE_THREEDBARFLAT:
     372             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     373           0 :                     StackMode_NONE, BarChartTypeTemplate::HORIZONTAL, 3 ));
     374           0 :                 break;
     375             :             case TEMPLATE_STACKEDTHREEDBARFLAT:
     376             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     377           0 :                     StackMode_Y_STACKED, BarChartTypeTemplate::HORIZONTAL, 3 ));
     378           0 :                 break;
     379             :             case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
     380             :                 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
     381           0 :                     StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::HORIZONTAL, 3 ));
     382           0 :                 break;
     383             : 
     384             :             // Combi-Chart Line/Column
     385             :             case TEMPLATE_COLUMNWITHLINE:
     386             :             case TEMPLATE_STACKEDCOLUMNWITHLINE:
     387             :             {
     388             :                 StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE )
     389             :                     ? StackMode_NONE
     390           0 :                     : StackMode_Y_STACKED;
     391             : 
     392           0 :                 xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 ));
     393             :             }
     394           0 :             break;
     395             : 
     396             :             // Area
     397             :             case TEMPLATE_AREA:
     398           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_NONE ));
     399           0 :                 break;
     400             :             case TEMPLATE_STACKEDAREA:
     401           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED ));
     402           0 :                 break;
     403             :             case TEMPLATE_PERCENTSTACKEDAREA:
     404           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED_PERCENT ));
     405           0 :                 break;
     406             :             case TEMPLATE_THREEDAREA:
     407           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Z_STACKED, 3 ));
     408           0 :                 break;
     409             :             case TEMPLATE_STACKEDTHREEDAREA:
     410           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED, 3 ));
     411           0 :                 break;
     412             :             case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
     413           0 :                 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED_PERCENT, 3 ));
     414           0 :                 break;
     415             : 
     416             :             case TEMPLATE_PIE:
     417             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     418           0 :                     chart2::PieChartOffsetMode_NONE, false ));
     419           0 :                 break;
     420             :             case TEMPLATE_PIEALLEXPLODED:
     421             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     422           0 :                     chart2::PieChartOffsetMode_ALL_EXPLODED, false ));
     423           0 :                 break;
     424             :             case TEMPLATE_DONUT:
     425             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     426           0 :                     chart2::PieChartOffsetMode_NONE, true ));
     427           0 :                 break;
     428             :             case TEMPLATE_DONUTALLEXPLODED:
     429             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     430           0 :                     chart2::PieChartOffsetMode_ALL_EXPLODED, true ));
     431           0 :                 break;
     432             :             case TEMPLATE_THREEDPIE:
     433             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     434           0 :                     chart2::PieChartOffsetMode_NONE, false, 3 ));
     435           0 :                 break;
     436             :             case TEMPLATE_THREEDPIEALLEXPLODED:
     437             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     438           0 :                     chart2::PieChartOffsetMode_ALL_EXPLODED, false, 3 ));
     439           0 :                 break;
     440             :             case TEMPLATE_THREEDDONUT:
     441             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     442           0 :                     chart2::PieChartOffsetMode_NONE, true, 3 ));
     443           0 :                 break;
     444             :             case TEMPLATE_THREEDDONUTALLEXPLODED:
     445             :                 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
     446           0 :                     chart2::PieChartOffsetMode_ALL_EXPLODED, true, 3 ));
     447           0 :                 break;
     448             : 
     449             :             case TEMPLATE_SCATTERLINESYMBOL:
     450           0 :                 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true ));
     451           0 :                 break;
     452             :             case TEMPLATE_SCATTERLINE:
     453           0 :                 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false ));
     454           0 :                 break;
     455             :             case TEMPLATE_SCATTERSYMBOL:
     456           0 :                 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false ));
     457           0 :                 break;
     458             :             case TEMPLATE_THREEDSCATTER:
     459           0 :                 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 ));
     460           0 :                 break;
     461             : 
     462             :             // NetChart
     463             :             case TEMPLATE_NET:
     464             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     465           0 :                     StackMode_NONE, true ));
     466           0 :                 break;
     467             :             case TEMPLATE_NETSYMBOL:
     468             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     469           0 :                     StackMode_NONE, true, false ));
     470           0 :                 break;
     471             :             case TEMPLATE_NETLINE:
     472             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     473           0 :                     StackMode_NONE, false ));
     474           0 :                 break;
     475             : 
     476             :             case TEMPLATE_STACKEDNET:
     477             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     478           0 :                     StackMode_Y_STACKED, true ));
     479           0 :                 break;
     480             :             case TEMPLATE_STACKEDNETSYMBOL:
     481             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     482           0 :                     StackMode_Y_STACKED, true, false ));
     483           0 :                 break;
     484             :             case TEMPLATE_STACKEDNETLINE:
     485             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     486           0 :                     StackMode_Y_STACKED, false, true ));
     487           0 :                 break;
     488             : 
     489             :             case TEMPLATE_PERCENTSTACKEDNET:
     490             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     491           0 :                     StackMode_Y_STACKED_PERCENT, true ));
     492           0 :                 break;
     493             :             case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
     494             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     495           0 :                     StackMode_Y_STACKED_PERCENT, true, false ));
     496           0 :                 break;
     497             :             case TEMPLATE_PERCENTSTACKEDNETLINE:
     498             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     499           0 :                     StackMode_Y_STACKED_PERCENT, false, true ));
     500           0 :                 break;
     501             : 
     502             :             case TEMPLATE_FILLEDNET:
     503             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     504           0 :                     StackMode_NONE, false, false, true ));
     505           0 :                 break;
     506             :             case TEMPLATE_STACKEDFILLEDNET:
     507             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     508           0 :                     StackMode_Y_STACKED, false, false, true ));
     509           0 :                 break;
     510             :             case TEMPLATE_PERCENTSTACKEDFILLEDNET:
     511             :                 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
     512           0 :                     StackMode_Y_STACKED_PERCENT, false, false, true ));
     513           0 :                 break;
     514             : 
     515             :             case TEMPLATE_STOCKLOWHIGHCLOSE:
     516             :                 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
     517           0 :                     StockChartTypeTemplate::LOW_HI_CLOSE, false ));
     518           0 :                 break;
     519             :             case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
     520             :                 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
     521           0 :                     StockChartTypeTemplate::OPEN_LOW_HI_CLOSE, true ));
     522           0 :                 break;
     523             :             case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
     524             :                 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
     525           0 :                     StockChartTypeTemplate::VOL_LOW_HI_CLOSE, false ));
     526           0 :                 break;
     527             :             case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
     528             :                 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
     529           0 :                     StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE, true ));
     530           0 :                 break;
     531             : 
     532             :             //BubbleChart
     533             :             case TEMPLATE_BUBBLE:
     534           0 :                 xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
     535           0 :                 break;
     536             : 
     537             :             case TEMPLATE_GL3DBAR:
     538           0 :                 xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
     539           0 :                 break;
     540             :             case TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE:
     541           0 :                 xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
     542           0 :                 break;
     543             : 
     544             : //            case TEMPLATE_SURFACE:
     545             : //            case TEMPLATE_ADDIN:
     546             : //               break;
     547             : 
     548             :             case TEMPLATE_NOT_FOUND:
     549             :                 OSL_ASSERT( false );
     550           0 :                 break;
     551             :         }
     552           0 :         xResult.set( xTemplate, uno::UNO_QUERY );
     553             :     }
     554             : 
     555           0 :     return xResult;
     556             : }
     557             : 
     558           0 : uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstanceWithArguments(
     559             :     const OUString& ServiceSpecifier,
     560             :     const uno::Sequence< uno::Any >& /* Arguments */ )
     561             :     throw (uno::Exception,
     562             :            uno::RuntimeException, std::exception)
     563             : {
     564             :     OSL_FAIL( "createInstanceWithArguments: No arguments supported" );
     565           0 :     return createInstance( ServiceSpecifier );
     566             : }
     567             : 
     568           0 : uno::Sequence< OUString > SAL_CALL ChartTypeManager::getAvailableServiceNames()
     569             :     throw (uno::RuntimeException, std::exception)
     570             : {
     571           0 :     ::std::vector< OUString > aServices;
     572           0 :     const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
     573           0 :     aServices.reserve( rMap.size());
     574             : 
     575             :     // get own default templates
     576             :     ::std::transform( rMap.begin(), rMap.end(), ::std::back_inserter( aServices ),
     577           0 :                       ::o3tl::select1st< tTemplateMapType::value_type >());
     578             : 
     579             :     // add components that were registered in the context's factory
     580             :     uno::Reference< container::XContentEnumerationAccess > xEnumAcc(
     581           0 :         m_xContext->getServiceManager(), uno::UNO_QUERY );
     582           0 :     if( xEnumAcc.is())
     583             :     {
     584             :         uno::Reference< container::XEnumeration > xEnum(
     585           0 :             xEnumAcc->createContentEnumeration( "com.sun.star.chart2.ChartTypeTemplate" ));
     586           0 :         if( xEnum.is())
     587             :         {
     588           0 :             uno::Reference< uno::XInterface > xFactIntf;
     589             : 
     590           0 :             while( xEnum->hasMoreElements())
     591             :             {
     592           0 :                 if( xEnum->nextElement() >>= xFactIntf )
     593             :                 {
     594           0 :                     uno::Reference< lang::XServiceName > xServiceName( xFactIntf, uno::UNO_QUERY );
     595           0 :                     if( xServiceName.is())
     596           0 :                         aServices.push_back( xServiceName->getServiceName());
     597             :                 }
     598           0 :             }
     599           0 :         }
     600             :     }
     601             : 
     602           0 :     return ContainerHelper::ContainerToSequence( aServices );
     603             : }
     604             : 
     605             : // ____ XServiceInfo ____
     606           0 : Sequence< OUString > ChartTypeManager::getSupportedServiceNames_Static()
     607             : {
     608           0 :     Sequence< OUString > aServices( 2 );
     609           0 :     aServices[ 0 ] = "com.sun.star.chart2.ChartTypeManager";
     610           0 :     aServices[ 1 ] = "com.sun.star.lang.MultiServiceFactory";
     611           0 :     return aServices;
     612             : }
     613             : 
     614             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     615           0 : APPHELPER_XSERVICEINFO_IMPL( ChartTypeManager,
     616             :                              OUString("com.sun.star.comp.chart.ChartTypeManager") );
     617             : } //  namespace chart
     618             : 
     619             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10