LCOV - code coverage report
Current view: top level - oox/source/drawingml/chart - plotareaconverter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 193 201 96.0 %
Date: 2015-06-13 12:38:46 Functions: 25 30 83.3 %
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/plotareaconverter.hxx"
      21             : 
      22             : #include <com/sun/star/chart/XChartDocument.hpp>
      23             : #include <com/sun/star/chart/XDiagramPositioning.hpp>
      24             : #include <com/sun/star/chart2/XChartDocument.hpp>
      25             : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
      26             : #include <com/sun/star/chart2/XDiagram.hpp>
      27             : #include <com/sun/star/drawing/Direction3D.hpp>
      28             : #include <com/sun/star/drawing/ProjectionMode.hpp>
      29             : #include <com/sun/star/drawing/ShadeMode.hpp>
      30             : #include <osl/diagnose.h>
      31             : #include "drawingml/chart/axisconverter.hxx"
      32             : #include "drawingml/chart/plotareamodel.hxx"
      33             : #include "drawingml/chart/typegroupconverter.hxx"
      34             : 
      35             : namespace oox {
      36             : namespace drawingml {
      37             : namespace chart {
      38             : 
      39             : using namespace ::com::sun::star;
      40             : using namespace ::com::sun::star::chart2;
      41             : using namespace ::com::sun::star::uno;
      42             : 
      43             : namespace {
      44             : 
      45             : /** Axes set model. This is a helper for the plot area converter collecting all
      46             :     type groups and axes of the primary or secondary axes set. */
      47             : struct AxesSetModel
      48             : {
      49             :     typedef ModelVector< TypeGroupModel >       TypeGroupVector;
      50             :     typedef ModelMap< sal_Int32, AxisModel >    AxisMap;
      51             : 
      52             :     TypeGroupVector     maTypeGroups;       /// All type groups containing data series.
      53             :     AxisMap             maAxes;             /// All axes mapped by API axis type.
      54             : 
      55         176 :     inline explicit     AxesSetModel() {}
      56         176 :     inline              ~AxesSetModel() {}
      57             : };
      58             : 
      59             : /** Axes set converter. This is a helper class for the plot area converter. */
      60             : class AxesSetConverter : public ConverterBase< AxesSetModel >
      61             : {
      62             : public:
      63             :     explicit            AxesSetConverter( const ConverterRoot& rParent, AxesSetModel& rModel );
      64             :     virtual             ~AxesSetConverter();
      65             : 
      66             :     /** Converts the axes set model to a chart2 diagram. Returns an automatic
      67             :         chart title from a single series title, if possible. */
      68             :     void                convertFromModel(
      69             :                             const Reference< XDiagram >& rxDiagram,
      70             :                             View3DModel& rView3DModel,
      71             :                             sal_Int32 nAxesSetIdx,
      72             :                             bool bSupportsVaryColorsByPoint );
      73             : 
      74             :     /** Returns the automatic chart title if the axes set contains only one series. */
      75         165 :     inline const OUString& getAutomaticTitle() const { return maAutoTitle; }
      76             :     /** Returns true, if the chart is three-dimensional. */
      77         165 :     inline bool         is3dChart() const { return mb3dChart; }
      78             :     /** Returns true, if chart type supports wall and floor format in 3D mode. */
      79         165 :     inline bool         isWall3dChart() const { return mbWall3dChart; }
      80             :     /** Returns true, if chart is a pie chart or doughnut chart. */
      81         165 :     inline bool         isPieChart() const { return mbPieChart; }
      82             : 
      83             : private:
      84             :     OUString     maAutoTitle;
      85             :     bool                mb3dChart;
      86             :     bool                mbWall3dChart;
      87             :     bool                mbPieChart;
      88             : };
      89             : 
      90         176 : AxesSetConverter::AxesSetConverter( const ConverterRoot& rParent, AxesSetModel& rModel ) :
      91             :     ConverterBase< AxesSetModel >( rParent, rModel ),
      92             :     mb3dChart( false ),
      93             :     mbWall3dChart( false ),
      94         176 :     mbPieChart( false )
      95             : {
      96         176 : }
      97             : 
      98         176 : AxesSetConverter::~AxesSetConverter()
      99             : {
     100         176 : }
     101             : 
     102         352 : ModelRef< AxisModel > lclGetOrCreateAxis( const AxesSetModel::AxisMap& rFromAxes, sal_Int32 nAxisIdx, sal_Int32 nDefTypeId, bool bMSO2007Doc )
     103             : {
     104         352 :     ModelRef< AxisModel > xAxis = rFromAxes.get( nAxisIdx );
     105         352 :     if( !xAxis )
     106          46 :         xAxis.create( nDefTypeId, bMSO2007Doc ).mbDeleted = true;  // missing axis is invisible
     107         352 :     return xAxis;
     108             : }
     109             : 
     110         176 : void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
     111             :         View3DModel& rView3DModel, sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint )
     112             : {
     113             :     // create type group converter objects for all type groups
     114             :     typedef RefVector< TypeGroupConverter > TypeGroupConvVector;
     115         176 :     TypeGroupConvVector aTypeGroups;
     116         354 :     for( AxesSetModel::TypeGroupVector::iterator aIt = mrModel.maTypeGroups.begin(), aEnd = mrModel.maTypeGroups.end(); aIt != aEnd; ++aIt )
     117         178 :         aTypeGroups.push_back( TypeGroupConvVector::value_type( new TypeGroupConverter( *this, **aIt ) ) );
     118             : 
     119             :     OSL_ENSURE( !aTypeGroups.empty(), "AxesSetConverter::convertFromModel - no type groups in axes set" );
     120         176 :     if( !aTypeGroups.empty() ) try
     121             :     {
     122             :         // first type group needed for coordinate system and axis conversion
     123         176 :         TypeGroupConverter& rFirstTypeGroup = *aTypeGroups.front();
     124             : 
     125             :         // get automatic chart title, if there is only one type group
     126         176 :         if( aTypeGroups.size() == 1 )
     127         174 :             maAutoTitle = rFirstTypeGroup.getSingleSeriesTitle();
     128             : 
     129             :         /*  Create a coordinate system. For now, all type groups from all axes sets
     130             :             have to be inserted into one coordinate system. Later, chart2 should
     131             :             support using one coordinate system for each axes set. */
     132         176 :         Reference< XCoordinateSystem > xCoordSystem;
     133         352 :         Reference< XCoordinateSystemContainer > xCoordSystemCont( rxDiagram, UNO_QUERY_THROW );
     134         352 :         Sequence< Reference< XCoordinateSystem > > aCoordSystems = xCoordSystemCont->getCoordinateSystems();
     135         176 :         if( aCoordSystems.hasElements() )
     136             :         {
     137             :             OSL_ENSURE( aCoordSystems.getLength() == 1, "AxesSetConverter::convertFromModel - too many coordinate systems" );
     138          11 :             xCoordSystem = aCoordSystems[ 0 ];
     139             :             OSL_ENSURE( xCoordSystem.is(), "AxesSetConverter::convertFromModel - invalid coordinate system" );
     140             :         }
     141             :         else
     142             :         {
     143         165 :             xCoordSystem = rFirstTypeGroup.createCoordinateSystem();
     144         165 :             if( xCoordSystem.is() )
     145         165 :                 xCoordSystemCont->addCoordinateSystem( xCoordSystem );
     146             :         }
     147             : 
     148             :         // 3D view settings
     149         176 :         mb3dChart = rFirstTypeGroup.is3dChart();
     150         176 :         mbWall3dChart = rFirstTypeGroup.isWall3dChart();
     151         176 :         mbPieChart = rFirstTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE;
     152         176 :         if( mb3dChart )
     153             :         {
     154          36 :             View3DConverter aView3DConv( *this, rView3DModel );
     155          36 :             aView3DConv.convertFromModel( rxDiagram, rFirstTypeGroup );
     156             :         }
     157             : 
     158             :         /*  Convert all chart type groups. Each type group will add its series
     159             :             to the data provider attached to the chart document. */
     160         176 :         if( xCoordSystem.is() )
     161             :         {
     162         176 :             bool bMSO2007Doc = getFilter().isMSO2007Document();
     163             :             // convert all axes (create missing axis models)
     164         176 :             ModelRef< AxisModel > xXAxis = lclGetOrCreateAxis( mrModel.maAxes, API_X_AXIS, rFirstTypeGroup.getTypeInfo().mbCategoryAxis ? C_TOKEN( catAx ) : C_TOKEN( valAx ), bMSO2007Doc );
     165         352 :             ModelRef< AxisModel > xYAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Y_AXIS, C_TOKEN( valAx ), bMSO2007Doc );
     166             : 
     167         352 :             AxisConverter aXAxisConv( *this, *xXAxis );
     168         176 :             aXAxisConv.convertFromModel( xCoordSystem, aTypeGroups, xYAxis.get(), nAxesSetIdx, API_X_AXIS );
     169         352 :             AxisConverter aYAxisConv( *this, *xYAxis );
     170         176 :             aYAxisConv.convertFromModel( xCoordSystem, aTypeGroups, xXAxis.get(), nAxesSetIdx, API_Y_AXIS );
     171             : 
     172         176 :             if( rFirstTypeGroup.isDeep3dChart() )
     173             :             {
     174           0 :                 ModelRef< AxisModel > xZAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Z_AXIS, C_TOKEN( serAx ), bMSO2007Doc );
     175           0 :                 AxisConverter aZAxisConv( *this, *xZAxis );
     176           0 :                 aZAxisConv.convertFromModel( xCoordSystem, aTypeGroups, 0, nAxesSetIdx, API_Z_AXIS );
     177             :             }
     178             : 
     179             :             // convert all chart type groups, this converts all series data and formatting
     180         354 :             for( TypeGroupConvVector::iterator aTIt = aTypeGroups.begin(), aTEnd = aTypeGroups.end(); aTIt != aTEnd; ++aTIt )
     181         354 :                 (*aTIt)->convertFromModel( rxDiagram, xCoordSystem, nAxesSetIdx, bSupportsVaryColorsByPoint );
     182         176 :         }
     183             :     }
     184           0 :     catch( Exception& )
     185             :     {
     186         176 :     }
     187         176 : }
     188             : 
     189             : } // namespace
     190             : 
     191          36 : View3DConverter::View3DConverter( const ConverterRoot& rParent, View3DModel& rModel ) :
     192          36 :     ConverterBase< View3DModel >( rParent, rModel )
     193             : {
     194          36 : }
     195             : 
     196          36 : View3DConverter::~View3DConverter()
     197             : {
     198          36 : }
     199             : 
     200          36 : void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, TypeGroupConverter& rTypeGroup )
     201             : {
     202             :     namespace cssd = ::com::sun::star::drawing;
     203          36 :     PropertySet aPropSet( rxDiagram );
     204             : 
     205          36 :     sal_Int32 nRotationY = 0;
     206          36 :     sal_Int32 nRotationX = 0;
     207          36 :     bool bRightAngled = false;
     208          36 :     sal_Int32 nAmbientColor = 0;
     209          36 :     sal_Int32 nLightColor = 0;
     210             : 
     211          36 :     if( rTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE )
     212             :     {
     213             :         // Y rotation used as 'first pie slice angle' in 3D pie charts
     214           6 :         rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.get( 0 ) );
     215             :         // X rotation a.k.a. elevation (map OOXML [0..90] to Chart2 [-90,0])
     216           6 :         nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.get( 15 ), 0, 90 ) - 90;
     217             :         // no right-angled axes in pie charts
     218           6 :         bRightAngled = false;
     219             :         // ambient color (Gray 30%)
     220           6 :         nAmbientColor = 0xB3B3B3;
     221             :         // light color (Gray 70%)
     222           6 :         nLightColor = 0x4C4C4C;
     223             :     }
     224             :     else // 3D bar/area/line charts
     225             :     {
     226             :         // Y rotation (OOXML [0..359], Chart2 [-179,180])
     227          30 :         nRotationY = mrModel.monRotationY.get( 20 );
     228             :         // X rotation a.k.a. elevation (OOXML [-90..90], Chart2 [-179,180])
     229          30 :         nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.get( 15 ), -90, 90 );
     230             :         // right-angled axes
     231          30 :         bRightAngled = mrModel.mbRightAngled;
     232             :         // ambient color (Gray 20%)
     233          30 :         nAmbientColor = 0xCCCCCC;
     234             :         // light color (Gray 60%)
     235          30 :         nLightColor = 0x666666;
     236             :     }
     237             : 
     238             :     // Y rotation (map OOXML [0..359] to Chart2 [-179,180])
     239          36 :     nRotationY %= 360;
     240          36 :     if( nRotationY > 180 ) nRotationY -= 360;
     241             :     /*  Perspective (map OOXML [0..200] to Chart2 [0,100]). Seems that MSO 2007 is
     242             :         buggy here, the XML plugin of MSO 2003 writes the correct perspective in
     243             :         the range from 0 to 100. We will emulate the wrong behaviour of MSO 2007. */
     244          36 :     sal_Int32 nPerspective = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.mnPerspective / 2, 0, 100 );
     245             :     // projection mode (parallel axes, if right-angled, #i90360# or if perspective is at 0%)
     246          36 :     bool bParallel = bRightAngled || (nPerspective == 0);
     247          36 :     cssd::ProjectionMode eProjMode = bParallel ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE;
     248             : 
     249             :     // set rotation properties
     250          36 :     aPropSet.setProperty( PROP_RightAngledAxes, bRightAngled );
     251          36 :     aPropSet.setProperty( PROP_RotationVertical, nRotationY );
     252          36 :     aPropSet.setProperty( PROP_RotationHorizontal, nRotationX );
     253          36 :     aPropSet.setProperty( PROP_Perspective, nPerspective );
     254          36 :     aPropSet.setProperty( PROP_D3DScenePerspective, eProjMode );
     255             : 
     256             :     // set light settings
     257          36 :     aPropSet.setProperty( PROP_D3DSceneShadeMode, cssd::ShadeMode_FLAT );
     258          36 :     aPropSet.setProperty( PROP_D3DSceneAmbientColor, nAmbientColor );
     259          36 :     aPropSet.setProperty( PROP_D3DSceneLightOn1, false );
     260          36 :     aPropSet.setProperty( PROP_D3DSceneLightOn2, true );
     261          36 :     aPropSet.setProperty( PROP_D3DSceneLightColor2, nLightColor );
     262          36 :     aPropSet.setProperty( PROP_D3DSceneLightDirection2, cssd::Direction3D( 0.2, 0.4, 1.0 ) );
     263          36 : }
     264             : 
     265          60 : WallFloorConverter::WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel ) :
     266          60 :     ConverterBase< WallFloorModel >( rParent, rModel )
     267             : {
     268          60 : }
     269             : 
     270          60 : WallFloorConverter::~WallFloorConverter()
     271             : {
     272          60 : }
     273             : 
     274          60 : void WallFloorConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, ObjectType eObjType )
     275             : {
     276          60 :     bool bMSO2007Doc = getFilter().isMSO2007Document();
     277          60 :     if( rxDiagram.is() )
     278             :     {
     279          60 :         PropertySet aPropSet;
     280          60 :         switch( eObjType )
     281             :         {
     282          30 :             case OBJECTTYPE_FLOOR:  aPropSet.set( rxDiagram->getFloor() );  break;
     283          30 :             case OBJECTTYPE_WALL:   aPropSet.set( rxDiagram->getWall() );   break;
     284             :             default:                OSL_FAIL( "WallFloorConverter::convertFromModel - invalid object type" );
     285             :         }
     286          60 :         if( aPropSet.is() )
     287          60 :             getFormatter().convertFrameFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxPicOptions.getOrCreate(bMSO2007Doc), eObjType );
     288             :     }
     289          60 : }
     290             : 
     291         165 : DataTableConverter::DataTableConverter( const ConverterRoot& rParent, DataTableModel& rModel ) :
     292         165 :         ConverterBase< DataTableModel >( rParent, rModel )
     293             : {
     294         165 : }
     295             : 
     296         165 : DataTableConverter::~DataTableConverter()
     297             : {
     298         165 : }
     299             : 
     300         165 : void DataTableConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
     301             : {
     302         165 :     PropertySet aPropSet( rxDiagram );
     303         165 :     if (mrModel.mbShowHBorder)
     304          14 :         aPropSet.setProperty( PROP_DataTableHBorder, mrModel.mbShowHBorder );
     305         165 :     if (mrModel.mbShowVBorder)
     306          14 :         aPropSet.setProperty( PROP_DataTableVBorder, mrModel.mbShowVBorder);
     307         165 :     if (mrModel.mbShowOutline)
     308          14 :         aPropSet.setProperty( PROP_DataTableOutline, mrModel.mbShowOutline );
     309         165 : }
     310             : 
     311         165 : PlotAreaConverter::PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ) :
     312             :     ConverterBase< PlotAreaModel >( rParent, rModel ),
     313             :     mb3dChart( false ),
     314             :     mbWall3dChart( false ),
     315         165 :     mbPieChart( false )
     316             : {
     317         165 : }
     318             : 
     319         165 : PlotAreaConverter::~PlotAreaConverter()
     320             : {
     321         165 : }
     322             : 
     323         165 : void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel )
     324             : {
     325             :     /*  Create the diagram object and attach it to the chart document. One
     326             :         diagram is used to carry all coordinate systems and data series. */
     327         165 :     Reference< XDiagram > xDiagram;
     328             :     try
     329             :     {
     330         165 :         xDiagram.set( createInstance( "com.sun.star.chart2.Diagram" ), UNO_QUERY_THROW );
     331         165 :         getChartDocument()->setFirstDiagram( xDiagram );
     332             :     }
     333           0 :     catch( Exception& )
     334             :     {
     335             :     }
     336             : 
     337             :     // store all axis models in a map, keyed by axis identifier
     338             :     typedef ModelMap< sal_Int32, AxisModel > AxisMap;
     339         330 :     AxisMap aAxisMap;
     340         471 :     for( PlotAreaModel::AxisVector::iterator aAIt = mrModel.maAxes.begin(), aAEnd = mrModel.maAxes.end(); aAIt != aAEnd; ++aAIt )
     341             :     {
     342         306 :         PlotAreaModel::AxisVector::value_type xAxis = *aAIt;
     343             :         OSL_ENSURE( xAxis->mnAxisId >= 0, "PlotAreaConverter::convertFromModel - invalid axis identifier" );
     344             :         OSL_ENSURE( !aAxisMap.has( xAxis->mnAxisId ), "PlotAreaConverter::convertFromModel - axis identifiers not unique" );
     345         306 :         if( xAxis->mnAxisId != -1 )
     346         306 :             aAxisMap[ xAxis->mnAxisId ] = xAxis;
     347         306 :     }
     348             : 
     349             :     // group the type group models into different axes sets
     350             :     typedef ModelVector< AxesSetModel > AxesSetVector;
     351         330 :     AxesSetVector aAxesSets;
     352         165 :     sal_Int32 nMaxSeriesIdx = -1;
     353         343 :     for( PlotAreaModel::TypeGroupVector::iterator aTIt = mrModel.maTypeGroups.begin(), aTEnd = mrModel.maTypeGroups.end(); aTIt != aTEnd; ++aTIt )
     354             :     {
     355         178 :         PlotAreaModel::TypeGroupVector::value_type xTypeGroup = *aTIt;
     356         178 :         if( !xTypeGroup->maSeries.empty() )
     357             :         {
     358             :             // try to find a compatible axes set for the type group
     359         178 :             AxesSetModel* pAxesSet = 0;
     360         191 :             for( AxesSetVector::iterator aASIt = aAxesSets.begin(), aASEnd = aAxesSets.end(); !pAxesSet && (aASIt != aASEnd); ++aASIt )
     361          13 :                 if( (*aASIt)->maTypeGroups.front()->maAxisIds == xTypeGroup->maAxisIds )
     362           2 :                     pAxesSet = aASIt->get();
     363             : 
     364             :             // not possible to insert into an existing axes set -> start a new axes set
     365         178 :             if( !pAxesSet )
     366             :             {
     367         176 :                 pAxesSet = &aAxesSets.create();
     368             :                 // find axis models used by the type group
     369         176 :                 const TypeGroupModel::AxisIdVector& rAxisIds = xTypeGroup->maAxisIds;
     370         176 :                 if( rAxisIds.size() >= 1 )
     371         153 :                     pAxesSet->maAxes[ API_X_AXIS ] = aAxisMap.get( rAxisIds[ 0 ] );
     372         176 :                 if( rAxisIds.size() >= 2 )
     373         153 :                     pAxesSet->maAxes[ API_Y_AXIS ] = aAxisMap.get( rAxisIds[ 1 ] );
     374         176 :                 if( rAxisIds.size() >= 3 )
     375          30 :                     pAxesSet->maAxes[ API_Z_AXIS ] = aAxisMap.get( rAxisIds[ 2 ] );
     376             :             }
     377             : 
     378             :             // insert the type group model
     379         178 :             pAxesSet->maTypeGroups.push_back( xTypeGroup );
     380             : 
     381             :             // collect the maximum series index for automatic series formatting
     382         518 :             for( TypeGroupModel::SeriesVector::iterator aSIt = xTypeGroup->maSeries.begin(), aSEnd = xTypeGroup->maSeries.end(); aSIt != aSEnd; ++aSIt )
     383         340 :                 nMaxSeriesIdx = ::std::max( nMaxSeriesIdx, (*aSIt)->mnIndex );
     384             :         }
     385         178 :     }
     386         165 :     getFormatter().setMaxSeriesIndex( nMaxSeriesIdx );
     387             : 
     388             :     // varying point colors only for single series in single chart type
     389         165 :     bool bSupportsVaryColorsByPoint = mrModel.maTypeGroups.size() == 1;
     390             : 
     391             :     // convert all axes sets
     392         341 :     for( AxesSetVector::iterator aASBeg = aAxesSets.begin(), aASIt = aASBeg, aASEnd = aAxesSets.end(); aASIt != aASEnd; ++aASIt )
     393             :     {
     394         176 :         AxesSetConverter aAxesSetConv( *this, **aASIt );
     395         176 :         sal_Int32 nAxesSetIdx = static_cast< sal_Int32 >( aASIt - aASBeg );
     396         176 :         aAxesSetConv.convertFromModel( xDiagram, rView3DModel, nAxesSetIdx, bSupportsVaryColorsByPoint );
     397         176 :         if( nAxesSetIdx == 0 )
     398             :         {
     399         165 :             maAutoTitle = aAxesSetConv.getAutomaticTitle();
     400         165 :             mb3dChart = aAxesSetConv.is3dChart();
     401         165 :             mbWall3dChart = aAxesSetConv.isWall3dChart();
     402         165 :             mbPieChart = aAxesSetConv.isPieChart();
     403             :         }
     404             :         else
     405             :         {
     406          11 :             maAutoTitle.clear();
     407             :         }
     408         176 :     }
     409             : 
     410         330 :     DataTableConverter dataTableConverter (*this, mrModel.mxDataTable.getOrCreate());
     411         165 :     dataTableConverter.convertFromModel(xDiagram);
     412             :     // plot area formatting
     413         165 :     if( xDiagram.is() && !mb3dChart )
     414             :     {
     415         129 :         PropertySet aPropSet( xDiagram->getWall() );
     416         129 :         getFormatter().convertFrameFormatting( aPropSet, mrModel.mxShapeProp, OBJECTTYPE_PLOTAREA2D );
     417         165 :     }
     418         165 : }
     419             : 
     420         165 : void PlotAreaConverter::convertPositionFromModel()
     421             : {
     422         165 :     LayoutModel& rLayout = mrModel.mxLayout.getOrCreate();
     423         165 :     LayoutConverter aLayoutConv( *this, rLayout );
     424         165 :     awt::Rectangle aDiagramRect;
     425         165 :     if( aLayoutConv.calcAbsRectangle( aDiagramRect ) ) try
     426             :     {
     427             :         namespace cssc = ::com::sun::star::chart;
     428           3 :         Reference< cssc::XChartDocument > xChart1Doc( getChartDocument(), UNO_QUERY_THROW );
     429           6 :         Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
     430             :         // for pie charts, always set inner plot area size to exclude the data labels as Excel does
     431           3 :         sal_Int32 nTarget = (mbPieChart && (rLayout.mnTarget == XML_outer)) ? XML_inner : rLayout.mnTarget;
     432           3 :         switch( nTarget )
     433             :         {
     434             :             case XML_inner:
     435           3 :                 xPositioning->setDiagramPositionExcludingAxes( aDiagramRect );
     436           3 :             break;
     437             :             case XML_outer:
     438           0 :                 xPositioning->setDiagramPositionIncludingAxes( aDiagramRect );
     439           0 :             break;
     440             :             default:
     441             :                 OSL_FAIL( "PlotAreaConverter::convertPositionFromModel - unknown positioning target" );
     442           3 :         }
     443             :     }
     444           0 :     catch( Exception& )
     445             :     {
     446         165 :     }
     447         165 : }
     448             : 
     449             : } // namespace chart
     450             : } // namespace drawingml
     451         246 : } // namespace oox
     452             : 
     453             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11