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

Generated by: LCOV version 1.10