LCOV - code coverage report
Current view: top level - chart2/source/view/axes - VCoordinateSystem.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 255 284 89.8 %
Date: 2014-04-11 Functions: 36 42 85.7 %
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 "VCoordinateSystem.hxx"
      21             : #include "VCartesianCoordinateSystem.hxx"
      22             : #include "VPolarCoordinateSystem.hxx"
      23             : #include "ScaleAutomatism.hxx"
      24             : #include "VSeriesPlotter.hxx"
      25             : #include "AbstractShapeFactory.hxx"
      26             : #include "servicenames_coosystems.hxx"
      27             : #include "macros.hxx"
      28             : #include "AxisIndexDefines.hxx"
      29             : #include "ObjectIdentifier.hxx"
      30             : #include "ExplicitCategoriesProvider.hxx"
      31             : #include "AxisHelper.hxx"
      32             : #include "ContainerHelper.hxx"
      33             : #include "VAxisBase.hxx"
      34             : #include "ViewDefines.hxx"
      35             : #include "DataSeriesHelper.hxx"
      36             : #include "defines.hxx"
      37             : #include "chartview/ExplicitValueProvider.hxx"
      38             : #include <com/sun/star/chart2/AxisType.hpp>
      39             : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      40             : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
      41             : 
      42             : #include <rtl/math.hxx>
      43             : 
      44             : namespace chart
      45             : {
      46             : using namespace ::com::sun::star;
      47             : using namespace ::com::sun::star::chart2;
      48             : using ::com::sun::star::uno::Reference;
      49             : using ::com::sun::star::uno::Sequence;
      50             : 
      51         618 : VCoordinateSystem* VCoordinateSystem::createCoordinateSystem(
      52             :             const Reference< XCoordinateSystem >& xCooSysModel )
      53             : {
      54         618 :     if( !xCooSysModel.is() )
      55           0 :         return 0;
      56             : 
      57         618 :     OUString aViewServiceName = xCooSysModel->getViewServiceName();
      58             : 
      59             :     //@todo: in future the coordinatesystems should be instanciated via service factory
      60         618 :     VCoordinateSystem* pRet=NULL;
      61         618 :     if( aViewServiceName.equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ) )
      62         603 :         pRet = new VCartesianCoordinateSystem(xCooSysModel);
      63          15 :     else if( aViewServiceName.equals( CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ) )
      64          15 :         pRet = new VPolarCoordinateSystem(xCooSysModel);
      65         618 :     if(!pRet)
      66           0 :         pRet = new VCoordinateSystem(xCooSysModel);
      67         618 :     return pRet;
      68             : }
      69             : 
      70         618 : VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
      71             :     : m_xCooSysModel(xCooSys)
      72             :     , m_xLogicTargetForGrids(0)
      73             :     , m_xLogicTargetForAxes(0)
      74             :     , m_xFinalTarget(0)
      75             :     , m_xShapeFactory(0)
      76             :     , m_aMatrixSceneToScreen()
      77             :     , m_eLeftWallPos(CuboidPlanePosition_Left)
      78             :     , m_eBackWallPos(CuboidPlanePosition_Back)
      79             :     , m_eBottomPos(CuboidPlanePosition_Bottom)
      80             :     , m_aMergedMinimumAndMaximumSupplier()
      81             :     , m_aExplicitScales(3)
      82             :     , m_aExplicitIncrements(3)
      83         618 :     , m_apExplicitCategoriesProvider(NULL)
      84             : {
      85         618 :     if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 )
      86             :     {
      87         606 :         m_aExplicitScales[2].Minimum = 1.0;
      88         606 :         m_aExplicitScales[2].Maximum = 2.0;
      89         606 :         m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL;
      90             :     }
      91         618 : }
      92         511 : VCoordinateSystem::~VCoordinateSystem()
      93             : {
      94         511 : }
      95             : 
      96         617 : void VCoordinateSystem::initPlottingTargets(  const Reference< drawing::XShapes >& xLogicTarget
      97             :        , const Reference< drawing::XShapes >& xFinalTarget
      98             :        , const Reference< lang::XMultiServiceFactory >& xShapeFactory
      99             :        , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
     100             :             throw (uno::RuntimeException)
     101             : {
     102             :     OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
     103             :     //is only allowed to be called once
     104             : 
     105         617 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
     106             :     //create group shape for grids first thus axes are always painted above grids
     107         617 :     AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory);
     108         617 :     if(nDimensionCount==2)
     109             :     {
     110             :         //create and add to target
     111         605 :         m_xLogicTargetForGrids = pShapeFactory->createGroup2D( xLogicTarget );
     112         605 :         xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup2D( xLogicTarget );
     113         605 :         m_xLogicTargetForAxes = pShapeFactory->createGroup2D( xLogicTarget );
     114             :     }
     115             :     else
     116             :     {
     117             :         //create and added to target
     118          12 :         m_xLogicTargetForGrids = pShapeFactory->createGroup3D( xLogicTarget );
     119          12 :         xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup3D( xLogicTarget );
     120          12 :         m_xLogicTargetForAxes = pShapeFactory->createGroup3D( xLogicTarget );
     121             :     }
     122         617 :     m_xFinalTarget  = xFinalTarget;
     123         617 :     m_xShapeFactory = xShapeFactory;
     124         617 : }
     125             : 
     126         618 : void VCoordinateSystem::setParticle( const OUString& rCooSysParticle )
     127             : {
     128         618 :     m_aCooSysParticle = rCooSysParticle;
     129         618 : }
     130             : 
     131        2453 : void VCoordinateSystem::setTransformationSceneToScreen(
     132             :     const drawing::HomogenMatrix& rMatrix )
     133             : {
     134        2453 :     m_aMatrixSceneToScreen = rMatrix;
     135             : 
     136             :     //correct transformation for axis
     137        2453 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     138        2453 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     139        7329 :     for( ; aIt != aEnd; ++aIt )
     140             :     {
     141        4876 :         VAxisBase* pVAxis = aIt->second.get();
     142        4876 :         if( pVAxis )
     143             :         {
     144        4876 :             if(2==pVAxis->getDimensionCount())
     145        4744 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     146             :         }
     147             :     }
     148        2453 : }
     149             : 
     150         621 : drawing::HomogenMatrix VCoordinateSystem::getTransformationSceneToScreen()
     151             : {
     152         621 :     return m_aMatrixSceneToScreen;
     153             : }
     154             : 
     155             : //better performance for big data
     156         619 : uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
     157             :             const awt::Size& rPageSize, const awt::Size& rPageResolution )
     158             : {
     159         619 :     uno::Sequence< sal_Int32 > aResolution(2);
     160             : 
     161         619 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
     162         619 :     if(nDimensionCount>2)
     163          12 :         aResolution.realloc(nDimensionCount);
     164         619 :     sal_Int32 nN = 0;
     165        1869 :     for( nN = 0 ;nN<aResolution.getLength(); nN++ )
     166        1250 :         aResolution[nN]=1000;
     167             : 
     168             :     ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
     169             :         BaseGFXHelper::HomogenMatrixToB3DHomMatrix(
     170        1238 :             m_aMatrixSceneToScreen ) ) );
     171             : 
     172         619 :     double fCoosysWidth = static_cast< double >( fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
     173         619 :     double fCoosysHeight = static_cast< double >( fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
     174             : 
     175         619 :     double fPageWidth = rPageSize.Width;
     176         619 :     double fPageHeight = rPageSize.Height;
     177             : 
     178             :     //factor 2 to avoid rounding problems
     179         619 :     sal_Int32 nXResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Width)*fCoosysWidth/fPageWidth);
     180         619 :     sal_Int32 nYResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Height)*fCoosysHeight/fPageHeight);
     181             : 
     182         619 :     if( nXResolution < 10 )
     183           0 :         nXResolution = 10;
     184         619 :     if( nYResolution < 10 )
     185           0 :         nYResolution = 10;
     186             : 
     187         619 :     if( this->getPropertySwapXAndYAxis() )
     188           2 :         std::swap(nXResolution,nYResolution);
     189             : 
     190             :     //2D
     191         619 :     if( 2 == aResolution.getLength() )
     192             :     {
     193         607 :         aResolution[0]=nXResolution;
     194         607 :         aResolution[1]=nYResolution;
     195             :     }
     196             :     else
     197             :     {
     198             :         //this maybe can be optimized further ...
     199          12 :         sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
     200          12 :         nMaxResolution*=2;
     201          48 :         for( nN = 0 ;nN<aResolution.getLength(); nN++ )
     202          36 :             aResolution[nN]=nMaxResolution;
     203             :     }
     204             : 
     205        1238 :     return aResolution;
     206             : }
     207             : 
     208        4183 : Reference< XCoordinateSystem > VCoordinateSystem::getModel() const
     209             : {
     210        4183 :     return m_xCooSysModel;
     211             : }
     212             : 
     213        2474 : Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
     214             : {
     215        2474 :     if( m_xCooSysModel.is() )
     216        2474 :         return m_xCooSysModel->getAxisByDimension( nDimensionIndex, nAxisIndex );
     217           0 :     return 0;
     218             : }
     219             : 
     220        1215 : Sequence< Reference< beans::XPropertySet > > VCoordinateSystem::getGridListFromAxis( const Reference< XAxis >& xAxis )
     221             : {
     222        1215 :     std::vector< Reference< beans::XPropertySet > > aRet;
     223             : 
     224        1215 :     if( xAxis.is() )
     225             :     {
     226        1215 :         aRet.push_back( xAxis->getGridProperties() );
     227        1215 :         std::vector< Reference< beans::XPropertySet > > aSubGrids( ContainerHelper::SequenceToVector( xAxis->getSubGridProperties() ) );
     228        1215 :         aRet.insert( aRet.end(), aSubGrids.begin(), aSubGrids.end() );
     229             :     }
     230             : 
     231        1215 :     return ContainerHelper::ContainerToSequence( aRet );
     232             : }
     233             : 
     234       25445 : void VCoordinateSystem::impl_adjustDimension( sal_Int32& rDimensionIndex ) const
     235             : {
     236       25445 :     if( rDimensionIndex<0 )
     237           0 :         rDimensionIndex=0;
     238       25445 :     if( rDimensionIndex>2 )
     239           0 :         rDimensionIndex=2;
     240       25445 : }
     241             : 
     242       21743 : void VCoordinateSystem::impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const
     243             : {
     244       21743 :     impl_adjustDimension( rDimensionIndex );
     245             : 
     246       21743 :     if( rAxisIndex < 0 || rAxisIndex > this->getMaximumAxisIndexByDimension(rDimensionIndex) )
     247           0 :         rAxisIndex = 0;
     248       21743 : }
     249             : 
     250         618 : void VCoordinateSystem::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider /*takes ownership*/ )
     251             : {
     252         618 :     m_apExplicitCategoriesProvider.reset(pExplicitCategoriesProvider);
     253         618 : }
     254             : 
     255        3094 : ExplicitCategoriesProvider* VCoordinateSystem::getExplicitCategoriesProvider()
     256             : {
     257        3094 :     return m_apExplicitCategoriesProvider.get();
     258             : }
     259             : 
     260        4876 : std::vector< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
     261             : {
     262        4876 :     std::vector< ExplicitScaleData > aRet(m_aExplicitScales);
     263             : 
     264        4876 :     impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
     265        4876 :     aRet[nDimensionIndex]=this->getExplicitScale( nDimensionIndex, nAxisIndex );
     266             : 
     267        4876 :     return aRet;
     268             : }
     269             : 
     270           0 : std::vector< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
     271             : {
     272           0 :     std::vector< ExplicitIncrementData > aRet(m_aExplicitIncrements);
     273             : 
     274           0 :     impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
     275           0 :     aRet[nDimensionIndex]=this->getExplicitIncrement( nDimensionIndex, nAxisIndex );
     276             : 
     277           0 :     return aRet;
     278             : }
     279             : 
     280       11493 : ExplicitScaleData VCoordinateSystem::getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
     281             : {
     282       11493 :     ExplicitScaleData aRet;
     283             : 
     284       11493 :     impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
     285             : 
     286       11493 :     if( nAxisIndex == 0)
     287             :     {
     288       11461 :         aRet = m_aExplicitScales[nDimensionIndex];
     289             :     }
     290             :     else
     291             :     {
     292          32 :         tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
     293          32 :         tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.find( aFullAxisIndex );
     294          32 :         if( aIt != m_aSecondaryExplicitScales.end() )
     295          32 :             aRet = aIt->second;
     296             :         else
     297           0 :             aRet = m_aExplicitScales[nDimensionIndex];
     298             :     }
     299             : 
     300       11493 :     return aRet;
     301             : }
     302             : 
     303        5374 : ExplicitIncrementData VCoordinateSystem::getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
     304             : {
     305        5374 :     ExplicitIncrementData aRet;
     306             : 
     307        5374 :     impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
     308             : 
     309        5374 :     if( nAxisIndex == 0)
     310             :     {
     311        5362 :         aRet = m_aExplicitIncrements[nDimensionIndex];
     312             :     }
     313             :     else
     314             :     {
     315          12 :         tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
     316          12 :         tFullExplicitIncrementMap::const_iterator aIt = m_aSecondaryExplicitIncrements.find( aFullAxisIndex );
     317          12 :         if( aIt != m_aSecondaryExplicitIncrements.end() )
     318          12 :             aRet = aIt->second;
     319             :         else
     320           0 :             aRet = m_aExplicitIncrements[nDimensionIndex];
     321             :     }
     322             : 
     323        5374 :     return aRet;
     324             : }
     325             : 
     326        1219 : OUString VCoordinateSystem::createCIDForAxis( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
     327             : {
     328        1219 :     OUString aAxisParticle( ObjectIdentifier::createParticleForAxis( nDimensionIndex, nAxisIndex ) );
     329        1219 :     return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aAxisParticle );
     330             : }
     331        1215 : OUString VCoordinateSystem::createCIDForGrid( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
     332             : {
     333        1215 :     OUString aGridParticle( ObjectIdentifier::createParticleForGrid( nDimensionIndex, nAxisIndex ) );
     334        1215 :     return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aGridParticle );
     335             : }
     336             : 
     337       22966 : sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const
     338             : {
     339       22966 :     sal_Int32 nRet = 0;
     340       22966 :     tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.begin();
     341       22966 :     tFullExplicitScaleMap::const_iterator aEnd = m_aSecondaryExplicitScales.end();
     342       23505 :     for(; aIt!=aEnd; ++aIt)
     343             :     {
     344         539 :         if(aIt->first.first==nDimensionIndex)
     345             :         {
     346         241 :             sal_Int32 nLocalIdx = aIt->first.second;
     347         241 :             if( nRet < nLocalIdx )
     348         241 :                 nRet = nLocalIdx;
     349             :         }
     350             :     }
     351       22966 :     return nRet;
     352             : }
     353             : 
     354           0 : void VCoordinateSystem::createVAxisList(
     355             :               const uno::Reference< util::XNumberFormatsSupplier > & /* xNumberFormatsSupplier */
     356             :             , const awt::Size& /* rFontReferenceSize */
     357             :             , const awt::Rectangle& /* rMaximumSpaceForLabels */
     358             :             )
     359             : {
     360           0 : }
     361             : 
     362           0 : void VCoordinateSystem::initVAxisInList()
     363             : {
     364           0 : }
     365           0 : void VCoordinateSystem::updateScalesAndIncrementsOnAxes()
     366             : {
     367           0 : }
     368             : 
     369        2483 : void VCoordinateSystem::prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
     370             : {
     371        2483 :     if( rScaleAutomatism.getScale().AxisType==AxisType::DATE && nDimIndex==0 )
     372             :     {
     373           0 :         sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::MONTH;
     374           0 :         if( !(rScaleAutomatism.getScale().TimeIncrement.TimeResolution >>= nTimeResolution) )
     375             :         {
     376           0 :             nTimeResolution = m_aMergedMinimumAndMaximumSupplier.calculateTimeResolutionOnXAxis();
     377           0 :             rScaleAutomatism.setAutomaticTimeResolution( nTimeResolution );
     378             :         }
     379           0 :         m_aMergedMinimumAndMaximumSupplier.setTimeResolutionOnXAxis( nTimeResolution, rScaleAutomatism.getNullDate() );
     380             :     }
     381             : 
     382        2483 :     double fMin = 0.0;
     383        2483 :     double fMax = 0.0;
     384        2483 :     ::rtl::math::setInf(&fMin, false);
     385        2483 :     ::rtl::math::setInf(&fMax, true);
     386        2483 :     if( 0 == nDimIndex )
     387             :     {
     388        1229 :         fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumX();
     389        1229 :         fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumX();
     390             :     }
     391        1254 :     else if( 1 == nDimIndex )
     392             :     {
     393        1231 :         ExplicitScaleData aScale = getExplicitScale( 0, 0 );
     394        1231 :         fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
     395        1231 :         fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
     396             :     }
     397          23 :     else if( 2 == nDimIndex )
     398             :     {
     399          23 :         fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumZ();
     400          23 :         fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumZ();
     401             :     }
     402             : 
     403             :     //merge our values with those already contained in rScaleAutomatism
     404        2483 :     rScaleAutomatism.expandValueRange( fMin, fMax );
     405             : 
     406             :     rScaleAutomatism.setAutoScalingOptions(
     407        2483 :         m_aMergedMinimumAndMaximumSupplier.isExpandBorderToIncrementRhythm( nDimIndex ),
     408        2483 :         m_aMergedMinimumAndMaximumSupplier.isExpandIfValuesCloseToBorder( nDimIndex ),
     409        2483 :         m_aMergedMinimumAndMaximumSupplier.isExpandWideValuesToZero( nDimIndex ),
     410        9932 :         m_aMergedMinimumAndMaximumSupplier.isExpandNarrowValuesTowardZero( nDimIndex ) );
     411             : 
     412        2483 :     VAxisBase* pVAxis( this->getVAxis( nDimIndex, nAxisIndex ) );
     413        2483 :     if( pVAxis )
     414        2442 :         rScaleAutomatism.setMaximumAutoMainIncrementCount( pVAxis->estimateMaximumAutoMainIncrementCount() );
     415        2483 : }
     416             : 
     417        2483 : VAxisBase* VCoordinateSystem::getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
     418             : {
     419        2483 :     VAxisBase* pRet = 0;
     420             : 
     421        2483 :     tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
     422             : 
     423        2483 :     tVAxisMap::const_iterator aIt = m_aAxisMap.find( aFullAxisIndex );
     424        2483 :     if( aIt != m_aAxisMap.end() )
     425        2442 :         pRet = aIt->second.get();
     426             : 
     427        2483 :     return pRet;
     428             : }
     429             : 
     430        3702 : void VCoordinateSystem::setExplicitScaleAndIncrement(
     431             :           sal_Int32 nDimensionIndex
     432             :         , sal_Int32 nAxisIndex
     433             :         , const ExplicitScaleData& rExplicitScale
     434             :         , const ExplicitIncrementData& rExplicitIncrement )
     435             : {
     436        3702 :     impl_adjustDimension( nDimensionIndex );
     437             : 
     438        3702 :     if( nAxisIndex==0 )
     439             :     {
     440        3680 :         m_aExplicitScales[nDimensionIndex]=rExplicitScale;
     441        3680 :         m_aExplicitIncrements[nDimensionIndex]=rExplicitIncrement;
     442             :     }
     443             :     else
     444             :     {
     445          22 :         tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
     446          22 :         m_aSecondaryExplicitScales[aFullAxisIndex] = rExplicitScale;
     447          22 :         m_aSecondaryExplicitIncrements[aFullAxisIndex] = rExplicitIncrement;
     448             :     }
     449        3702 : }
     450             : 
     451          12 : void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos )
     452             : {
     453          12 :     m_eLeftWallPos = eLeftWallPos;
     454          12 :     m_eBackWallPos = eBackWallPos;
     455          12 :     m_eBottomPos = eBottomPos;
     456          12 : }
     457             : 
     458         602 : void VCoordinateSystem::createMaximumAxesLabels()
     459             : {
     460         602 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     461         602 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     462        1821 :     for( ; aIt != aEnd; ++aIt )
     463             :     {
     464        1219 :         VAxisBase* pVAxis = aIt->second.get();
     465        1219 :         if( pVAxis )
     466             :         {
     467        1219 :             if(2==pVAxis->getDimensionCount())
     468        1186 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     469        1219 :             pVAxis->createMaximumLabels();
     470             :         }
     471             :     }
     472         602 : }
     473         602 : void VCoordinateSystem::createAxesLabels()
     474             : {
     475         602 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     476         602 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     477        1821 :     for( ; aIt != aEnd; ++aIt )
     478             :     {
     479        1219 :         VAxisBase* pVAxis = aIt->second.get();
     480        1219 :         if( pVAxis )
     481             :         {
     482        1219 :             if(2==pVAxis->getDimensionCount())
     483        1186 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     484        1219 :             pVAxis->createLabels();
     485             :         }
     486             :     }
     487         602 : }
     488             : 
     489         602 : void VCoordinateSystem::updatePositions()
     490             : {
     491         602 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     492         602 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     493        1821 :     for( ; aIt != aEnd; ++aIt )
     494             :     {
     495        1219 :         VAxisBase* pVAxis = aIt->second.get();
     496        1219 :         if( pVAxis )
     497             :         {
     498        1219 :             if(2==pVAxis->getDimensionCount())
     499        1186 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     500        1219 :             pVAxis->updatePositions();
     501             :         }
     502             :     }
     503         602 : }
     504             : 
     505         617 : void VCoordinateSystem::createAxesShapes()
     506             : {
     507         617 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     508         617 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     509        1836 :     for( ; aIt != aEnd; ++aIt )
     510             :     {
     511        1219 :         VAxisBase* pVAxis = aIt->second.get();
     512        1219 :         if( pVAxis )
     513             :         {
     514        1219 :             if(2==pVAxis->getDimensionCount())
     515        1186 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     516             : 
     517        1219 :             tFullAxisIndex aFullAxisIndex = aIt->first;
     518        1219 :             if( aFullAxisIndex.second == 0 )
     519             :             {
     520        1215 :                 if( aFullAxisIndex.first == 0 )
     521             :                 {
     522         602 :                     if( AxisType::CATEGORY!=m_aExplicitScales[1].AxisType )
     523             :                         pVAxis->setExrtaLinePositionAtOtherAxis(
     524         602 :                             m_aExplicitScales[1].Origin );
     525             :                 }
     526         613 :                 else if( aFullAxisIndex.first == 1 )
     527             :                 {
     528         602 :                     if( AxisType::CATEGORY!=m_aExplicitScales[0].AxisType )
     529             :                         pVAxis->setExrtaLinePositionAtOtherAxis(
     530          18 :                             m_aExplicitScales[0].Origin );
     531             :                 }
     532             :             }
     533             : 
     534        1219 :             pVAxis->createShapes();
     535             :         }
     536             :     }
     537         617 : }
     538           0 : void VCoordinateSystem::createGridShapes()
     539             : {
     540           0 : }
     541         620 : void VCoordinateSystem::addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
     542             : {
     543         620 :     m_aMergedMinimumAndMaximumSupplier.addMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
     544         620 : }
     545             : 
     546        2476 : bool VCoordinateSystem::hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
     547             : {
     548        2476 :     return m_aMergedMinimumAndMaximumSupplier.hasMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
     549             : }
     550             : 
     551         618 : void VCoordinateSystem::clearMinimumAndMaximumSupplierList()
     552             : {
     553         618 :     m_aMergedMinimumAndMaximumSupplier.clearMinimumAndMaximumSupplierList();
     554         618 : }
     555             : 
     556        4295 : bool VCoordinateSystem::getPropertySwapXAndYAxis() const
     557             : {
     558        4295 :     Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY );
     559        4295 :     sal_Bool bSwapXAndY = false;
     560        4295 :     if( xProp.is()) try
     561             :     {
     562        4295 :         xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
     563             :     }
     564           0 :     catch( const uno::Exception& e )
     565             :     {
     566             :         ASSERT_EXCEPTION( e );
     567             :     }
     568        4295 :     return bSwapXAndY;
     569             : }
     570             : 
     571         618 : bool VCoordinateSystem::needSeriesNamesForAxis() const
     572             : {
     573         618 :     return ( m_xCooSysModel.is() && m_xCooSysModel->getDimension() == 3 );
     574             : }
     575          12 : void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< OUString >& rSeriesNames )
     576             : {
     577          12 :     m_aSeriesNamesForZAxis = rSeriesNames;
     578          12 : }
     579             : 
     580        1131 : sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
     581             :         const Reference< chart2::XAxis >& xAxis
     582             :         , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
     583             : {
     584             :     return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
     585        1131 :                 xAxis, m_xCooSysModel, xNumberFormatsSupplier );
     586             : }
     587             : 
     588             : } //namespace chart
     589             : 
     590             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10