LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedScaleProperty.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 244 289 84.4 %
Date: 2014-04-11 Functions: 8 8 100.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 "WrappedScaleProperty.hxx"
      21             : #include "macros.hxx"
      22             : #include "CommonConverters.hxx"
      23             : #include "AxisHelper.hxx"
      24             : #include <com/sun/star/chart2/XAxis.hpp>
      25             : #include <com/sun/star/chart/ChartAxisType.hpp>
      26             : #include <chartview/ExplicitScaleValues.hxx>
      27             : 
      28             : using namespace ::com::sun::star;
      29             : using ::com::sun::star::uno::Any;
      30             : using namespace ::com::sun::star::chart2;
      31             : using ::com::sun::star::uno::Reference;
      32             : using ::com::sun::star::uno::Sequence;
      33             : using ::com::sun::star::chart::TimeIncrement;
      34             : 
      35             : namespace chart
      36             : {
      37             : namespace wrapper
      38             : {
      39             : 
      40        5728 : WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty
      41             :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      42             :             : WrappedProperty(OUString(),OUString())
      43             :             , m_spChart2ModelContact( spChart2ModelContact )
      44        5728 :             , m_eScaleProperty( eScaleProperty )
      45             : {
      46        5728 :     switch( m_eScaleProperty )
      47             :     {
      48             :         case SCALE_PROP_MAX:
      49         358 :             m_aOuterName = "Max";
      50         358 :             break;
      51             :         case SCALE_PROP_MIN:
      52         358 :             m_aOuterName = "Min";
      53         358 :             break;
      54             :         case SCALE_PROP_ORIGIN:
      55         358 :             m_aOuterName = "Origin";
      56         358 :             break;
      57             :         case SCALE_PROP_STEPMAIN:
      58         358 :             m_aOuterName = "StepMain";
      59         358 :             break;
      60             :         case SCALE_PROP_STEPHELP:
      61         358 :             m_aOuterName = "StepHelp";
      62         358 :             break;
      63             :         case SCALE_PROP_STEPHELP_COUNT:
      64         358 :             m_aOuterName = "StepHelpCount";
      65         358 :             break;
      66             :         case SCALE_PROP_AUTO_MAX:
      67         358 :             m_aOuterName = "AutoMax";
      68         358 :             break;
      69             :         case SCALE_PROP_AUTO_MIN:
      70         358 :             m_aOuterName = "AutoMin";
      71         358 :             break;
      72             :         case SCALE_PROP_AUTO_ORIGIN:
      73         358 :             m_aOuterName = "AutoOrigin";
      74         358 :             break;
      75             :         case SCALE_PROP_AUTO_STEPMAIN:
      76         358 :             m_aOuterName = "AutoStepMain";
      77         358 :             break;
      78             :         case SCALE_PROP_AUTO_STEPHELP:
      79         358 :             m_aOuterName = "AutoStepHelp";
      80         358 :             break;
      81             :         case SCALE_PROP_AXIS_TYPE:
      82         358 :             m_aOuterName = "AxisType";
      83         358 :             break;
      84             :         case SCALE_PROP_DATE_INCREMENT:
      85         358 :             m_aOuterName = "TimeIncrement";
      86         358 :             break;
      87             :         case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
      88         358 :             m_aOuterName = "ExplicitTimeIncrement";
      89         358 :             break;
      90             :         case SCALE_PROP_LOGARITHMIC:
      91         358 :             m_aOuterName = "Logarithmic";
      92         358 :             break;
      93             :         case SCALE_PROP_REVERSEDIRECTION:
      94         358 :             m_aOuterName = "ReverseDirection";
      95         358 :             break;
      96             :         default:
      97             :             OSL_FAIL("unknown scale property");
      98           0 :             break;
      99             :     }
     100        5728 : }
     101             : 
     102       11264 : WrappedScaleProperty::~WrappedScaleProperty()
     103             : {
     104       11264 : }
     105             : 
     106         358 : void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
     107             :             , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     108             : {
     109         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_MAX, spChart2ModelContact ) );
     110         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_MIN, spChart2ModelContact ) );
     111         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_ORIGIN, spChart2ModelContact ) );
     112         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPMAIN, spChart2ModelContact ) );
     113         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP, spChart2ModelContact ) );
     114         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP_COUNT, spChart2ModelContact ) );
     115         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MAX, spChart2ModelContact ) );
     116         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MIN, spChart2ModelContact ) );
     117         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_ORIGIN, spChart2ModelContact ) );
     118         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPMAIN, spChart2ModelContact ) );
     119         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) );
     120         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_AXIS_TYPE, spChart2ModelContact ) );
     121         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_DATE_INCREMENT, spChart2ModelContact ) );
     122         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_EXPLICIT_DATE_INCREMENT, spChart2ModelContact ) );
     123         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) );
     124         358 :     rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) );
     125         358 : }
     126             : 
     127         685 : void WrappedScaleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     128             :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     129             : {
     130         685 :     setPropertyValue( m_eScaleProperty, rOuterValue, xInnerPropertySet );
     131         685 : }
     132             : 
     133       17733 : Any WrappedScaleProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     134             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     135             : {
     136       17733 :     return getPropertyValue( m_eScaleProperty, xInnerPropertySet );
     137             : }
     138             : 
     139         685 : void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     140             :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     141             : {
     142         685 :     m_aOuterValue = rOuterValue;
     143             : 
     144         685 :     Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
     145             :     OSL_ENSURE(xAxis.is(),"need an XAxis");
     146         685 :     if(!xAxis.is())
     147         685 :         return;
     148             : 
     149         685 :     bool bSetScaleData     = false;
     150             : 
     151        1370 :     chart2::ScaleData aScaleData( xAxis->getScaleData() );
     152             : 
     153         685 :     sal_Bool bBool = false;
     154         685 :     switch( eScaleProperty )
     155             :     {
     156             :         case SCALE_PROP_MAX:
     157             :         {
     158           1 :             aScaleData.Maximum = rOuterValue;
     159           1 :             bSetScaleData = true;
     160           1 :             break;
     161             :         }
     162             :         case SCALE_PROP_MIN:
     163             :         {
     164           1 :             aScaleData.Minimum = rOuterValue;
     165           1 :             bSetScaleData = true;
     166           1 :             break;
     167             :         }
     168             :         case SCALE_PROP_STEPMAIN:
     169             :         {
     170           1 :             aScaleData.IncrementData.Distance = rOuterValue;
     171           1 :             bSetScaleData = true;
     172           1 :             break;
     173             :         }
     174             :         case SCALE_PROP_STEPHELP:
     175             :         {
     176           1 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     177           1 :             if( rSubIncrements.getLength() == 0 )
     178           0 :                 rSubIncrements.realloc( 1 );
     179             : 
     180           1 :             double fStepHelp = 0;
     181           1 :             if( (rOuterValue >>= fStepHelp) )
     182             :             {
     183           1 :                 double fStepMain = 0;
     184           1 :                 if( AxisHelper::isLogarithmic(aScaleData.Scaling) )
     185             :                 {
     186           0 :                     sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp);
     187           0 :                     rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
     188             :                 }
     189           2 :                 else if( (fStepHelp != 0.0) &&
     190           1 :                     (aScaleData.IncrementData.Distance >>= fStepMain) )
     191             :                 {
     192             :                     // approximate interval count
     193           1 :                     sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);
     194           1 :                     rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
     195             :                 }
     196             :             }
     197           1 :             bSetScaleData = true;
     198           1 :             break;
     199             :         }
     200             :         case SCALE_PROP_STEPHELP_COUNT:
     201             :         {
     202           0 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     203           0 :             if( rSubIncrements.getLength() == 0 )
     204           0 :                 rSubIncrements.realloc( 1 );
     205           0 :             sal_Int32 nIntervalCount=0;
     206           0 :             if( rOuterValue>>=nIntervalCount )
     207           0 :                 rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
     208             :             else
     209           0 :                 rSubIncrements[ 0 ].IntervalCount  = Any();
     210           0 :             bSetScaleData = true;
     211           0 :             break;
     212             :         }
     213             :         case SCALE_PROP_AUTO_MAX:
     214             :         {
     215           4 :             if( (rOuterValue >>= bBool) && bBool )
     216           2 :                 aScaleData.Maximum = Any();
     217             :             else
     218           2 :                 aScaleData.Maximum = getPropertyValue( SCALE_PROP_MAX, xInnerPropertySet );
     219           4 :             bSetScaleData = true;
     220           4 :             break;
     221             :         }
     222             :         case SCALE_PROP_AUTO_MIN:
     223             :         {
     224           4 :             if( (rOuterValue >>= bBool) && bBool )
     225           2 :                 aScaleData.Minimum = Any();
     226             :             else
     227           2 :                 aScaleData.Minimum = getPropertyValue( SCALE_PROP_MIN, xInnerPropertySet );
     228           4 :             bSetScaleData = true;
     229           4 :             break;
     230             :         }
     231             :         case SCALE_PROP_AUTO_STEPMAIN:
     232             :         {
     233           4 :             if( (rOuterValue >>= bBool) && bBool )
     234           2 :                 aScaleData.IncrementData.Distance = Any();
     235             :             else
     236           2 :                 aScaleData.IncrementData.Distance = getPropertyValue( SCALE_PROP_STEPMAIN, xInnerPropertySet );
     237           4 :             bSetScaleData = true;
     238           4 :             break;
     239             :         }
     240             :         case SCALE_PROP_AUTO_STEPHELP:
     241             :         {
     242           3 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     243           3 :             if( rSubIncrements.getLength() == 0 )
     244           0 :                 rSubIncrements.realloc( 1 );
     245             : 
     246           3 :             if( (rOuterValue >>= bBool) && bBool )
     247           2 :                 rSubIncrements[ 0 ].IntervalCount = Any();
     248             :             else
     249           1 :                 rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet );
     250           3 :             bSetScaleData = true;
     251           3 :             break;
     252             :         }
     253             :         case SCALE_PROP_ORIGIN:
     254             :         {
     255           4 :             aScaleData.Origin = rOuterValue;
     256           4 :             bSetScaleData = true;
     257           4 :             break;
     258             :         }
     259             :         case SCALE_PROP_AUTO_ORIGIN:
     260             :         {
     261         206 :             if( (rOuterValue >>= bBool) && bBool )
     262         205 :                 aScaleData.Origin = Any();
     263             :             else
     264           1 :                 aScaleData.Origin = getPropertyValue( SCALE_PROP_ORIGIN, xInnerPropertySet );
     265         206 :             bSetScaleData = true;
     266         206 :             break;
     267             :         }
     268             :         case SCALE_PROP_AXIS_TYPE:
     269             :         {
     270          52 :             sal_Int32 nType = 0;
     271          52 :             if( (rOuterValue >>= nType) )
     272             :             {
     273          52 :                 if( ::com::sun::star::chart::ChartAxisType::AUTOMATIC == nType )
     274             :                 {
     275          42 :                     aScaleData.AutoDateAxis = true;
     276          42 :                     if( aScaleData.AxisType == AxisType::DATE )
     277           0 :                         aScaleData.AxisType = AxisType::CATEGORY;
     278             :                 }
     279          10 :                 else if( ::com::sun::star::chart::ChartAxisType::CATEGORY == nType )
     280             :                 {
     281           9 :                     aScaleData.AutoDateAxis = false;
     282           9 :                     if( aScaleData.AxisType == AxisType::DATE )
     283           0 :                         aScaleData.AxisType = AxisType::CATEGORY;
     284             :                 }
     285           1 :                 else if( ::com::sun::star::chart::ChartAxisType::DATE == nType )
     286             :                 {
     287           0 :                     if( aScaleData.AxisType == AxisType::CATEGORY )
     288           0 :                         aScaleData.AxisType = AxisType::DATE;
     289             :                 }
     290          52 :                 bSetScaleData = true;
     291             :             }
     292          52 :             break;
     293             :         }
     294             :         case SCALE_PROP_DATE_INCREMENT:
     295             :         {
     296           1 :             TimeIncrement aTimeIncrement;
     297           1 :             rOuterValue >>= aTimeIncrement;
     298           1 :             aScaleData.TimeIncrement = aTimeIncrement;
     299           1 :             bSetScaleData = true;
     300           1 :             break;
     301             :         }
     302             :         case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
     303             :             //read only property
     304           0 :             break;
     305             :         case SCALE_PROP_LOGARITHMIC:
     306             :         {
     307         206 :             if( rOuterValue >>= bBool )
     308             :             {
     309         206 :                 bool bWasLogarithm = AxisHelper::isLogarithmic( aScaleData.Scaling );
     310             : 
     311             :                 // safe comparison between sal_Bool and bool
     312         206 :                 if( (!bBool) != (!bWasLogarithm) )
     313             :                 {
     314           5 :                     if( bBool )
     315           4 :                         aScaleData.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
     316             :                     else
     317           1 :                         aScaleData.Scaling = 0;
     318           5 :                     bSetScaleData = true;
     319             :                 }
     320             :             }
     321         206 :             break;
     322             :         }
     323             :         case SCALE_PROP_REVERSEDIRECTION:
     324             :         {
     325         197 :             if( rOuterValue >>= bBool )
     326             :             {
     327         197 :                 bool bWasReverse = ( AxisOrientation_REVERSE == aScaleData.Orientation );
     328         197 :                 if( (!bBool) != (!bWasReverse) ) // safe comparison between sal_Bool and bool
     329             :                 {
     330          20 :                     aScaleData.Orientation = bBool ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
     331          20 :                     bSetScaleData = true;
     332             :                 }
     333             :             }
     334         197 :             break;
     335             :         }
     336             :         default:
     337             :         {
     338             :             OSL_FAIL("unknown scale property");
     339           0 :             break;
     340             :         }
     341             :     }
     342             : 
     343         685 :     if( bSetScaleData )
     344         992 :         xAxis->setScaleData( aScaleData );
     345             : }
     346             : 
     347       17741 : Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     348             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     349             : {
     350       17741 :     Any aRet( m_aOuterValue );
     351             : 
     352       35482 :     Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
     353             :     OSL_ENSURE(xAxis.is(),"need an XAxis");
     354       17741 :     if(!xAxis.is())
     355           0 :         return aRet;
     356             : 
     357       35482 :     chart2::ScaleData aScaleData( xAxis->getScaleData() );
     358             : 
     359       35482 :     ExplicitScaleData aExplicitScale;
     360       35482 :     ExplicitIncrementData aExplicitIncrement;
     361             : 
     362       17741 :     switch( eScaleProperty )
     363             :     {
     364             :         case SCALE_PROP_MAX:
     365             :         {
     366        1816 :             aRet = aScaleData.Maximum;
     367        1816 :             if( !aRet.hasValue() )
     368             :             {
     369             :                 m_spChart2ModelContact->getExplicitValuesForAxis(
     370        1814 :                     xAxis, aExplicitScale, aExplicitIncrement );
     371        1814 :                 aRet <<= aExplicitScale.Maximum;
     372             :             }
     373        1816 :             break;
     374             :         }
     375             :         case SCALE_PROP_MIN:
     376             :         {
     377        1816 :             aRet = aScaleData.Minimum;
     378        1816 :             if( !aRet.hasValue() )
     379             :             {
     380             :                 m_spChart2ModelContact->getExplicitValuesForAxis(
     381        1814 :                     xAxis, aExplicitScale, aExplicitIncrement );
     382        1814 :                 aRet <<= aExplicitScale.Minimum;
     383             :             }
     384        1816 :             break;
     385             :         }
     386             : 
     387             :         case SCALE_PROP_STEPMAIN:
     388             :         {
     389        1816 :             aRet = aScaleData.IncrementData.Distance;
     390        1816 :             if( !aRet.hasValue() )
     391             :             {
     392             :                 m_spChart2ModelContact->getExplicitValuesForAxis(
     393        1814 :                     xAxis, aExplicitScale, aExplicitIncrement );
     394        1814 :                 aRet <<= aExplicitIncrement.Distance;
     395             :             }
     396        1816 :             break;
     397             :         }
     398             :         case SCALE_PROP_STEPHELP:
     399             :         {
     400             :             // todo: evaluate PostEquidistant
     401           2 :             bool bNeedToCalculateExplicitValues = true;
     402             : 
     403           2 :             bool bLogarithmic( AxisHelper::isLogarithmic(aScaleData.Scaling) );
     404           2 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     405           2 :             if( bLogarithmic )
     406             :             {
     407           0 :                 if( rSubIncrements.getLength() > 0 )
     408             :                 {
     409           0 :                     sal_Int32 nIntervalCount = 0;
     410           0 :                     rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount;
     411           0 :                     aRet = uno::makeAny( double(nIntervalCount) );
     412           0 :                     bNeedToCalculateExplicitValues = false;
     413             :                 }
     414             :             }
     415           2 :             else if( aScaleData.IncrementData.Distance.hasValue() )
     416             :             {
     417           2 :                 if( rSubIncrements.getLength() > 0 )
     418             :                 {
     419           2 :                     double fStepMain = 0;
     420           2 :                     sal_Int32 nIntervalCount = 0;
     421           6 :                     if( (aScaleData.IncrementData.Distance >>= fStepMain) &&
     422           3 :                         (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) &&
     423           1 :                         nIntervalCount > 0 )
     424             :                     {
     425           0 :                         aRet <<= ( fStepMain / static_cast< double >( nIntervalCount ) );
     426           0 :                         bNeedToCalculateExplicitValues = false;
     427             :                     }
     428             :                 }
     429             :                 else
     430             :                 {
     431           0 :                     aRet = aScaleData.IncrementData.Distance;
     432           0 :                     bNeedToCalculateExplicitValues = false;
     433             :                 }
     434             :             }
     435             : 
     436           2 :             if( bNeedToCalculateExplicitValues )
     437             :             {
     438             :                 m_spChart2ModelContact->getExplicitValuesForAxis(
     439           2 :                     xAxis, aExplicitScale, aExplicitIncrement );
     440             : 
     441           4 :                 if( !aExplicitIncrement.SubIncrements.empty() &&
     442           2 :                      aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 )
     443             :                 {
     444           1 :                     if( bLogarithmic )
     445             :                     {
     446           0 :                         if( rSubIncrements.getLength() > 0 )
     447             :                         {
     448           0 :                             sal_Int32 nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
     449           0 :                             aRet = uno::makeAny( double(nIntervalCount) );
     450             :                         }
     451             :                     }
     452             :                     else
     453           3 :                         aRet <<= ( aExplicitIncrement.Distance /
     454             :                                 static_cast< double >(
     455           2 :                                     aExplicitIncrement.SubIncrements[ 0 ].IntervalCount ));
     456             :                 }
     457             :                 else
     458             :                 {
     459           1 :                     if( bLogarithmic )
     460           0 :                         aRet <<= 5.0;
     461             :                     else
     462           1 :                         aRet <<= aExplicitIncrement.Distance;
     463             :                 }
     464             :             }
     465           2 :             break;
     466             :         }
     467             :         case SCALE_PROP_STEPHELP_COUNT:
     468             :         {
     469        1813 :             sal_Int32 nIntervalCount = 0;
     470        1813 :             bool bNeedToCalculateExplicitValues = true;
     471        1813 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     472        1813 :             if( rSubIncrements.getLength() > 0 )
     473             :             {
     474        1813 :                 if( (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) && (nIntervalCount > 0) )
     475           0 :                     bNeedToCalculateExplicitValues = false;
     476             :             }
     477        1813 :             if( bNeedToCalculateExplicitValues )
     478             :             {
     479        1813 :                 m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
     480        1813 :                 if( !aExplicitIncrement.SubIncrements.empty() )
     481          97 :                     nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
     482             :             }
     483        1813 :             aRet = uno::makeAny( nIntervalCount );
     484        1813 :             break;
     485             :         }
     486             :         case SCALE_PROP_AUTO_MAX:
     487             :         {
     488         961 :             aRet <<= (sal_Bool)( !aScaleData.Maximum.hasValue() );
     489         961 :             break;
     490             :         }
     491             :         case SCALE_PROP_AUTO_MIN:
     492             :         {
     493         961 :             aRet <<= (sal_Bool)( !aScaleData.Minimum.hasValue() );
     494         961 :             break;
     495             :         }
     496             :         case SCALE_PROP_AUTO_STEPMAIN:
     497             :         {
     498         961 :             aRet <<= (sal_Bool)( !aScaleData.IncrementData.Distance.hasValue() );
     499         961 :             break;
     500             :         }
     501             :         case SCALE_PROP_AUTO_STEPHELP:
     502             :         {
     503         961 :             Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
     504         961 :             if( rSubIncrements.getLength() > 0 )
     505         961 :                 aRet <<= (sal_Bool)( !rSubIncrements[ 0 ].IntervalCount.hasValue() );
     506             :             else
     507           0 :                 aRet <<= sal_True;
     508         961 :             break;
     509             :         }
     510             :         case SCALE_PROP_ORIGIN:
     511             :         {
     512        1815 :             aRet = aScaleData.Origin;
     513        1815 :             if( !aRet.hasValue() )
     514             :             {
     515             :                 m_spChart2ModelContact->getExplicitValuesForAxis(
     516        1814 :                     xAxis, aExplicitScale, aExplicitIncrement );
     517        1814 :                 aRet <<= aExplicitScale.Origin;
     518             :             }
     519        1815 :             break;
     520             :         }
     521             :         case SCALE_PROP_AUTO_ORIGIN:
     522             :         {
     523         913 :             aRet <<= !hasDoubleValue(aScaleData.Origin);
     524         913 :             break;
     525             :         }
     526             :         case SCALE_PROP_AXIS_TYPE:
     527             :         {
     528           2 :             sal_Int32 nType = ::com::sun::star::chart::ChartAxisType::AUTOMATIC;
     529           2 :             if( aScaleData.AxisType == AxisType::DATE )
     530             :             {
     531           0 :                 nType = ::com::sun::star::chart::ChartAxisType::DATE;
     532             :             }
     533           2 :             else if( aScaleData.AxisType == AxisType::CATEGORY )
     534             :             {
     535           0 :                 if( !aScaleData.AutoDateAxis )
     536           0 :                     nType = ::com::sun::star::chart::ChartAxisType::CATEGORY;
     537             :             }
     538           2 :             aRet = uno::makeAny( nType );
     539           2 :             break;
     540             :         }
     541             :         case SCALE_PROP_DATE_INCREMENT:
     542             :         {
     543         168 :             if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
     544         168 :                 aRet = uno::makeAny( aScaleData.TimeIncrement );
     545         168 :             break;
     546             :         }
     547             :         case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
     548             :         {
     549           4 :             if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
     550             :             {
     551           3 :                 m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
     552           3 :                 if( aExplicitScale.AxisType == AxisType::DATE )
     553             :                 {
     554           0 :                     TimeIncrement aTimeIncrement;
     555           0 :                     aTimeIncrement.MajorTimeInterval = uno::makeAny( aExplicitIncrement.MajorTimeInterval );
     556           0 :                     aTimeIncrement.MinorTimeInterval = uno::makeAny( aExplicitIncrement.MinorTimeInterval );
     557           0 :                     aTimeIncrement.TimeResolution = uno::makeAny( aExplicitScale.TimeResolution );
     558           0 :                     aRet = uno::makeAny(aTimeIncrement);
     559             :                 }
     560             :             }
     561             : 
     562           4 :             if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
     563           3 :                 aRet = uno::makeAny( aScaleData.TimeIncrement );
     564           4 :             break;
     565             :         }
     566             :         case SCALE_PROP_LOGARITHMIC:
     567             :         {
     568        1867 :             aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) );
     569        1867 :             break;
     570             :         }
     571             :         case SCALE_PROP_REVERSEDIRECTION:
     572             :         {
     573        1865 :             aRet <<= static_cast< sal_Bool >( AxisOrientation_REVERSE == aScaleData.Orientation );
     574        1865 :             break;
     575             :         }
     576             :         default:
     577             :         {
     578             :             OSL_FAIL("unknown scale property");
     579           0 :             break;
     580             :         }
     581             :     }
     582             : 
     583       17741 :     return aRet;
     584             : }
     585             : 
     586             : } //  namespace wrapper
     587             : } //  namespace chart
     588             : 
     589             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10