LCOV - code coverage report
Current view: top level - chart2/source/view/axes - VAxisProperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 155 186 83.3 %
Date: 2012-08-25 Functions: 16 18 88.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 137 243 56.4 %

           Branch data     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 "VAxisProperties.hxx"
      21                 :            : #include "macros.hxx"
      22                 :            : #include "ViewDefines.hxx"
      23                 :            : #include "CommonConverters.hxx"
      24                 :            : #include "AxisHelper.hxx"
      25                 :            : #include "DiagramHelper.hxx"
      26                 :            : #include "ChartModelHelper.hxx"
      27                 :            : 
      28                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      29                 :            : #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
      30                 :            : #include <com/sun/star/drawing/LineStyle.hpp>
      31                 :            : #include <com/sun/star/text/WritingMode2.hpp>
      32                 :            : 
      33                 :            : //.............................................................................
      34                 :            : namespace chart
      35                 :            : {
      36                 :            : //.............................................................................
      37                 :            : using namespace ::com::sun::star;
      38                 :            : using namespace ::com::sun::star::chart2;
      39                 :            : 
      40                 :       2806 : sal_Int32 lcl_calcTickLengthForDepth(sal_Int32 nDepth,sal_Int32 nTickmarkStyle)
      41                 :            : {
      42                 :       2806 :     sal_Int32 nWidth = AXIS2D_TICKLENGTH; //@maybefuturetodo this length could be offered by the model
      43                 :       2806 :     double fPercent = 1.0;
      44   [ +  +  -  - ]:       2806 :     switch(nDepth)
      45                 :            :     {
      46                 :            :         case 0:
      47                 :       2538 :             fPercent = 1.0;
      48                 :       2538 :             break;
      49                 :            :         case 1:
      50                 :        268 :             fPercent = 0.75;//percentage like in the old chart
      51                 :        268 :             break;
      52                 :            :         case 2:
      53                 :          0 :             fPercent = 0.5;
      54                 :          0 :             break;
      55                 :            :         default:
      56                 :          0 :             fPercent = 0.3;
      57                 :          0 :             break;
      58                 :            :     }
      59         [ +  + ]:       2806 :     if(nTickmarkStyle==3)//inner and outer tickmarks
      60                 :        600 :         fPercent*=2.0;
      61                 :       2806 :     return static_cast<sal_Int32>(nWidth*fPercent);
      62                 :            : }
      63                 :            : 
      64                 :       2806 : double lcl_getTickOffset(sal_Int32 nLength,sal_Int32 nTickmarkStyle)
      65                 :            : {
      66                 :       2806 :     double fPercent = 0.0; //0<=fPercent<=1
      67                 :            :     //0.0: completly inner
      68                 :            :     //1.0: completly outer
      69                 :            :     //0.5: half and half
      70                 :            : 
      71                 :            :     /*
      72                 :            :     nTickmarkStyle:
      73                 :            :     1: inner tickmarks
      74                 :            :     2: outer tickmarks
      75                 :            :     3: inner and outer tickmarks
      76                 :            :     */
      77      [ -  +  + ]:       2806 :     switch(nTickmarkStyle)
      78                 :            :     {
      79                 :            :         case 1:
      80                 :          0 :             fPercent = 0.0;
      81                 :          0 :             break;
      82                 :            :         case 2:
      83                 :       1670 :             fPercent = 1.0;
      84                 :       1670 :             break;
      85                 :            :         default:
      86                 :       1136 :             fPercent = 0.5;
      87                 :       1136 :             break;
      88                 :            :     }
      89                 :       2806 :     return fPercent*nLength;
      90                 :            : }
      91                 :            : 
      92                 :       2206 : VLineProperties AxisProperties::makeLinePropertiesForDepth( sal_Int32 /* nDepth */ ) const
      93                 :            : {
      94                 :            :     //@todo get this from somewhere; maybe for each subincrement
      95                 :            :     //so far the model does not offer different settings for each tick depth
      96                 :       2206 :     return m_aLineProperties;
      97                 :            : }
      98                 :            : 
      99                 :       2206 : TickmarkProperties AxisProperties::makeTickmarkProperties(
     100                 :            :                         sal_Int32 nDepth ) const
     101                 :            : {
     102                 :            :     /*
     103                 :            :     nTickmarkStyle:
     104                 :            :     1: inner tickmarks
     105                 :            :     2: outer tickmarks
     106                 :            :     3: inner and outer tickmarks
     107                 :            :     */
     108                 :       2206 :     sal_Int32 nTickmarkStyle = 1;
     109         [ +  + ]:       2206 :     if(nDepth==0)
     110                 :            :     {
     111                 :       1938 :         nTickmarkStyle = m_nMajorTickmarks;
     112         [ -  + ]:       1938 :         if(!nTickmarkStyle)
     113                 :            :         {
     114                 :            :             //create major tickmarks as if they were minor tickmarks
     115                 :          0 :             nDepth = 1;
     116                 :          0 :             nTickmarkStyle = m_nMinorTickmarks;
     117                 :            :         }
     118                 :            :     }
     119         [ +  - ]:        268 :     else if( nDepth==1)
     120                 :            :     {
     121                 :        268 :         nTickmarkStyle = m_nMinorTickmarks;
     122                 :            :     }
     123                 :            : 
     124         [ -  + ]:       2206 :     if( m_fInnerDirectionSign == 0.0 )
     125                 :            :     {
     126         [ #  # ]:          0 :         if( nTickmarkStyle != 0 )
     127                 :          0 :             nTickmarkStyle = 3; //inner and outer tickmarks
     128                 :            :     }
     129                 :            : 
     130                 :       2206 :     TickmarkProperties aTickmarkProperties;
     131                 :       2206 :     aTickmarkProperties.Length = lcl_calcTickLengthForDepth(nDepth,nTickmarkStyle);
     132                 :       2206 :     aTickmarkProperties.RelativePos = static_cast<sal_Int32>(lcl_getTickOffset(aTickmarkProperties.Length,nTickmarkStyle));
     133                 :       2206 :     aTickmarkProperties.aLineProperties = this->makeLinePropertiesForDepth( nDepth );
     134                 :       2206 :     return aTickmarkProperties;
     135                 :            : }
     136                 :            : 
     137                 :          0 : TickmarkProperties AxisProperties::makeTickmarkPropertiesForComplexCategories(
     138                 :            :     sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 /*nTextLevel*/ ) const
     139                 :            : {
     140         [ #  # ]:          0 :     sal_Int32 nTickmarkStyle = (m_fLabelDirectionSign==m_fInnerDirectionSign) ? 2/*outside*/ : 1/*inside*/;
     141                 :            : 
     142                 :          0 :     TickmarkProperties aTickmarkProperties;
     143                 :          0 :     aTickmarkProperties.Length = nTickLength;// + nTextLevel*( lcl_calcTickLengthForDepth(0,nTickmarkStyle) );
     144                 :          0 :     aTickmarkProperties.RelativePos = static_cast<sal_Int32>(lcl_getTickOffset(aTickmarkProperties.Length+nTickStartDistanceToAxis,nTickmarkStyle));
     145                 :          0 :     aTickmarkProperties.aLineProperties = this->makeLinePropertiesForDepth( 0 );
     146                 :          0 :     return aTickmarkProperties;
     147                 :            : }
     148                 :            : 
     149                 :        600 : TickmarkProperties AxisProperties::getBiggestTickmarkProperties()
     150                 :            : {
     151                 :        600 :     TickmarkProperties aTickmarkProperties;
     152                 :        600 :     sal_Int32 nDepth = 0;
     153                 :        600 :     sal_Int32 nTickmarkStyle = 3;//inner and outer tickmarks
     154                 :        600 :     aTickmarkProperties.Length = lcl_calcTickLengthForDepth( nDepth,nTickmarkStyle );
     155                 :        600 :     aTickmarkProperties.RelativePos = static_cast<sal_Int32>( lcl_getTickOffset( aTickmarkProperties.Length, nTickmarkStyle ) );
     156                 :        600 :     return aTickmarkProperties;
     157                 :            : }
     158                 :            : 
     159                 :            : //--------------------------------------------------------------------------
     160                 :            : 
     161                 :       1938 : AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
     162                 :            :                               , ExplicitCategoriesProvider* pExplicitCategoriesProvider )
     163                 :            :     : m_xAxisModel(xAxisModel)
     164                 :            :     , m_nDimensionIndex(0)
     165                 :            :     , m_bIsMainAxis(true)
     166                 :            :     , m_bSwapXAndY(false)
     167                 :            :     , m_eCrossoverType( ::com::sun::star::chart::ChartAxisPosition_ZERO )
     168                 :            :     , m_eLabelPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS )
     169                 :            :     , m_eTickmarkPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
     170                 :            :     , m_pfMainLinePositionAtOtherAxis(NULL)
     171                 :            :     , m_pfExrtaLinePositionAtOtherAxis(NULL)
     172                 :            :     , m_bCrossingAxisHasReverseDirection(false)
     173                 :            :     , m_bCrossingAxisIsCategoryAxes(false)
     174                 :            :     , m_fLabelDirectionSign(1.0)
     175                 :            :     , m_fInnerDirectionSign(1.0)
     176                 :            :     , m_aLabelAlignment(LABEL_ALIGN_RIGHT_TOP)
     177                 :            :     , m_bDisplayLabels( true )
     178                 :            :     , m_nNumberFormatKey(0)
     179                 :            :     , m_nMajorTickmarks(1)
     180                 :            :     , m_nMinorTickmarks(1)
     181                 :            :     , m_aTickmarkPropertiesList()
     182                 :            :     , m_aLineProperties()
     183                 :            :     //for category axes
     184                 :            :     , m_nAxisType(AxisType::REALNUMBER)
     185                 :            :     , m_bComplexCategories(false)
     186                 :            :     , m_pExplicitCategoriesProvider(pExplicitCategoriesProvider)
     187 [ +  - ][ +  - ]:       1938 :     , m_xAxisTextProvider(0)
                 [ +  - ]
     188                 :            : {
     189                 :       1938 : }
     190                 :            : 
     191                 :       1938 : AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
     192                 :            :     : m_xAxisModel( rAxisProperties.m_xAxisModel )
     193                 :            :     , m_nDimensionIndex( rAxisProperties.m_nDimensionIndex )
     194                 :            :     , m_bIsMainAxis( rAxisProperties.m_bIsMainAxis )
     195                 :            :     , m_bSwapXAndY( rAxisProperties.m_bSwapXAndY )
     196                 :            :     , m_eCrossoverType( rAxisProperties.m_eCrossoverType )
     197                 :            :     , m_eLabelPos( rAxisProperties.m_eLabelPos )
     198                 :            :     , m_eTickmarkPos( rAxisProperties.m_eTickmarkPos )
     199                 :            :     , m_pfMainLinePositionAtOtherAxis( NULL )
     200                 :            :     , m_pfExrtaLinePositionAtOtherAxis( NULL )
     201                 :            :     , m_bCrossingAxisHasReverseDirection( rAxisProperties.m_bCrossingAxisHasReverseDirection )
     202                 :            :     , m_bCrossingAxisIsCategoryAxes( rAxisProperties.m_bCrossingAxisIsCategoryAxes )
     203                 :            :     , m_fLabelDirectionSign( rAxisProperties.m_fLabelDirectionSign )
     204                 :            :     , m_fInnerDirectionSign( rAxisProperties.m_fInnerDirectionSign )
     205                 :            :     , m_aLabelAlignment( rAxisProperties.m_aLabelAlignment )
     206                 :            :     , m_bDisplayLabels( rAxisProperties.m_bDisplayLabels )
     207                 :            :     , m_nNumberFormatKey( rAxisProperties.m_nNumberFormatKey )
     208                 :            :     , m_nMajorTickmarks( rAxisProperties.m_nMajorTickmarks )
     209                 :            :     , m_nMinorTickmarks( rAxisProperties.m_nMinorTickmarks )
     210                 :            :     , m_aTickmarkPropertiesList( rAxisProperties.m_aTickmarkPropertiesList )
     211                 :            :     , m_aLineProperties( rAxisProperties.m_aLineProperties )
     212                 :            :     //for category axes
     213                 :            :     , m_nAxisType( rAxisProperties.m_nAxisType )
     214                 :            :     , m_bComplexCategories( rAxisProperties.m_bComplexCategories )
     215                 :            :     , m_pExplicitCategoriesProvider( rAxisProperties.m_pExplicitCategoriesProvider )
     216         [ +  - ]:       1938 :     , m_xAxisTextProvider( rAxisProperties.m_xAxisTextProvider )
     217                 :            : {
     218         [ +  + ]:       1938 :     if( rAxisProperties.m_pfMainLinePositionAtOtherAxis )
     219         [ +  - ]:       1768 :         m_pfMainLinePositionAtOtherAxis = new double(*rAxisProperties.m_pfMainLinePositionAtOtherAxis);
     220         [ -  + ]:       1938 :     if( rAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
     221         [ #  # ]:          0 :         m_pfExrtaLinePositionAtOtherAxis = new double (*rAxisProperties.m_pfExrtaLinePositionAtOtherAxis);
     222                 :       1938 : }
     223                 :            : 
     224                 :       3876 : AxisProperties::~AxisProperties()
     225                 :            : {
     226                 :       3876 :     delete m_pfMainLinePositionAtOtherAxis;
     227                 :       3876 :     delete m_pfExrtaLinePositionAtOtherAxis;
     228         [ -  + ]:       3876 : }
     229                 :            : 
     230                 :         14 : LabelAlignment lcl_getLabelAlignmentForZAxis( const AxisProperties& rAxisProperties )
     231                 :            : {
     232                 :         14 :     LabelAlignment aRet( LABEL_ALIGN_RIGHT );
     233         [ -  + ]:         14 :     if( rAxisProperties.m_fLabelDirectionSign<0 )
     234                 :          0 :         aRet = LABEL_ALIGN_LEFT;
     235                 :         14 :     return aRet;
     236                 :            : }
     237                 :            : 
     238                 :        962 : LabelAlignment lcl_getLabelAlignmentForYAxis( const AxisProperties& rAxisProperties )
     239                 :            : {
     240                 :        962 :     LabelAlignment aRet( LABEL_ALIGN_RIGHT );
     241         [ +  + ]:        962 :     if( rAxisProperties.m_fLabelDirectionSign<0 )
     242                 :        892 :         aRet = LABEL_ALIGN_LEFT;
     243                 :        962 :     return aRet;
     244                 :            : }
     245                 :            : 
     246                 :        962 : LabelAlignment lcl_getLabelAlignmentForXAxis( const AxisProperties& rAxisProperties )
     247                 :            : {
     248                 :        962 :     LabelAlignment aRet( LABEL_ALIGN_BOTTOM );
     249         [ +  + ]:        962 :     if( rAxisProperties.m_fLabelDirectionSign<0 )
     250                 :         72 :         aRet = LABEL_ALIGN_TOP;
     251                 :        962 :     return aRet;
     252                 :            : }
     253                 :            : 
     254                 :       1938 : void AxisProperties::initAxisPositioning( const uno::Reference< beans::XPropertySet >& xAxisProp )
     255                 :            : {
     256         [ -  + ]:       1938 :     if( !xAxisProp.is() )
     257                 :       1938 :         return;
     258                 :            :     try
     259                 :            :     {
     260 [ +  - ][ +  - ]:       1938 :         if( AxisHelper::isAxisPositioningEnabled() )
     261                 :            :         {
     262 [ +  - ][ +  - ]:       1938 :             xAxisProp->getPropertyValue(C2U( "CrossoverPosition" )) >>= m_eCrossoverType;
         [ +  - ][ +  - ]
     263         [ +  + ]:       1938 :             if( ::com::sun::star::chart::ChartAxisPosition_VALUE == m_eCrossoverType )
     264                 :            :             {
     265                 :        106 :                 double fValue = 0.0;
     266 [ +  - ][ +  - ]:        106 :                 xAxisProp->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue;
                 [ +  - ]
     267                 :            : 
     268         [ +  + ]:        106 :                 if( m_bCrossingAxisIsCategoryAxes )
     269                 :          3 :                     fValue = ::rtl::math::round(fValue);
     270         [ +  - ]:        106 :                 m_pfMainLinePositionAtOtherAxis = new double(fValue);
     271                 :            :             }
     272         [ +  + ]:       1832 :             else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == m_eCrossoverType )
     273         [ +  - ]:       1662 :                 m_pfMainLinePositionAtOtherAxis = new double(0.0);
     274                 :            : 
     275 [ +  - ][ +  - ]:       1938 :             xAxisProp->getPropertyValue(C2U( "LabelPosition" )) >>= m_eLabelPos;
         [ +  - ][ +  - ]
     276 [ +  - ][ +  - ]:       1938 :             xAxisProp->getPropertyValue(C2U( "MarkPosition" )) >>= m_eTickmarkPos;
         [ +  - ][ #  # ]
                 [ +  - ]
     277                 :            :         }
     278                 :            :         else
     279                 :            :         {
     280                 :          0 :             m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_START;
     281         [ #  # ]:          0 :             if( m_bIsMainAxis == m_bCrossingAxisHasReverseDirection )
     282                 :          0 :                 m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_END;
     283                 :          0 :             m_eLabelPos = ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS;
     284                 :          0 :             m_eTickmarkPos = ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS;
     285                 :            :         }
     286                 :            :     }
     287                 :          0 :     catch( const uno::Exception& e )
     288                 :            :     {
     289                 :            :         ASSERT_EXCEPTION( e );
     290                 :            :     }
     291                 :            : }
     292                 :            : 
     293                 :       1938 : void AxisProperties::init( bool bCartesian )
     294                 :            : {
     295                 :            :     uno::Reference< beans::XPropertySet > xProp =
     296         [ +  - ]:       1938 :         uno::Reference<beans::XPropertySet>::query( this->m_xAxisModel );
     297         [ -  + ]:       1938 :     if( !xProp.is() )
     298                 :       1938 :         return;
     299                 :            : 
     300         [ +  + ]:       1938 :     if( m_nDimensionIndex<2 )
     301         [ +  - ]:       1924 :         initAxisPositioning( xProp );
     302                 :            : 
     303 [ +  - ][ +  - ]:       1938 :     ScaleData aScaleData = m_xAxisModel->getScaleData();
     304         [ +  + ]:       1938 :     if( m_nDimensionIndex==0 )
     305         [ +  - ]:        962 :         AxisHelper::checkDateAxis( aScaleData, m_pExplicitCategoriesProvider, bCartesian );
     306                 :       1938 :     m_nAxisType = aScaleData.AxisType;
     307                 :            : 
     308         [ +  - ]:       1938 :     if( bCartesian )
     309                 :            :     {
     310 [ +  + ][ +  - ]:       2900 :         if( m_nDimensionIndex == 0 && m_nAxisType == AxisType::CATEGORY
         [ +  - ][ -  + ]
                 [ -  + ]
     311         [ +  - ]:        962 :                 && m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
     312                 :          0 :             m_bComplexCategories = true;
     313                 :            : 
     314         [ -  + ]:       1938 :         if( ::com::sun::star::chart::ChartAxisPosition_END == m_eCrossoverType )
     315         [ #  # ]:          0 :             m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
     316                 :            :         else
     317         [ +  + ]:       1938 :             m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
     318                 :            : 
     319         [ +  + ]:       1938 :         if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS == m_eLabelPos )
     320                 :       1768 :             m_fLabelDirectionSign = m_fInnerDirectionSign;
     321         [ +  + ]:        170 :         else if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE == m_eLabelPos )
     322                 :         70 :             m_fLabelDirectionSign = -m_fInnerDirectionSign;
     323         [ +  - ]:        100 :         else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_eLabelPos )
     324         [ -  + ]:        100 :             m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
     325         [ #  # ]:          0 :         else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_eLabelPos )
     326         [ #  # ]:          0 :             m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
     327                 :            : 
     328         [ +  + ]:       1938 :         if( m_nDimensionIndex==2 )
     329                 :         14 :             m_aLabelAlignment = lcl_getLabelAlignmentForZAxis(*this);
     330                 :            :         else
     331                 :            :         {
     332                 :        962 :             bool bIsYAxisPosition = (m_nDimensionIndex==1 && !m_bSwapXAndY)
     333 [ +  + ][ +  + ]:       1924 :                 || (m_nDimensionIndex==0 && m_bSwapXAndY);
         [ +  + ][ +  + ]
     334         [ +  + ]:       1924 :             if( bIsYAxisPosition )
     335                 :            :             {
     336                 :        962 :                 m_fLabelDirectionSign*=-1;
     337                 :        962 :                 m_fInnerDirectionSign*=-1;
     338                 :            :             }
     339                 :            : 
     340         [ +  + ]:       1924 :             if( bIsYAxisPosition )
     341                 :        962 :                 m_aLabelAlignment = lcl_getLabelAlignmentForYAxis(*this);
     342                 :            :             else
     343                 :        962 :                 m_aLabelAlignment = lcl_getLabelAlignmentForXAxis(*this);
     344                 :            :         }
     345                 :            :     }
     346                 :            : 
     347                 :            :     try
     348                 :            :     {
     349                 :            :         //init LineProperties
     350         [ +  - ]:       1938 :         m_aLineProperties.initFromPropertySet( xProp );
     351                 :            : 
     352                 :            :         //init display labels
     353 [ +  - ][ +  - ]:       1938 :         xProp->getPropertyValue( C2U( "DisplayLabels" ) ) >>= m_bDisplayLabels;
                 [ +  - ]
     354                 :            : 
     355                 :            :         //init TickmarkProperties
     356 [ +  - ][ +  - ]:       1938 :         xProp->getPropertyValue( C2U( "MajorTickmarks" ) ) >>= m_nMajorTickmarks;
                 [ +  - ]
     357 [ +  - ][ +  - ]:       1938 :         xProp->getPropertyValue( C2U( "MinorTickmarks" ) ) >>= m_nMinorTickmarks;
                 [ +  - ]
     358                 :            : 
     359                 :       1938 :         sal_Int32 nMaxDepth = 0;
     360         [ +  + ]:       1938 :         if(m_nMinorTickmarks!=0)
     361                 :        268 :             nMaxDepth=2;
     362         [ +  - ]:       1670 :         else if(m_nMajorTickmarks!=0)
     363                 :       1670 :             nMaxDepth=1;
     364                 :            : 
     365                 :       1938 :         this->m_aTickmarkPropertiesList.clear();
     366         [ +  + ]:       4144 :         for( sal_Int32 nDepth=0; nDepth<nMaxDepth; nDepth++ )
     367                 :            :         {
     368         [ +  - ]:       2206 :             TickmarkProperties aTickmarkProperties = this->makeTickmarkProperties( nDepth );
     369         [ +  - ]:       2206 :             this->m_aTickmarkPropertiesList.push_back( aTickmarkProperties );
     370         [ #  # ]:       2206 :         }
     371                 :            :     }
     372         [ #  # ]:          0 :     catch( const uno::Exception& e )
     373                 :            :     {
     374                 :            :         ASSERT_EXCEPTION( e );
     375 [ +  - ][ +  - ]:       1938 :     }
     376                 :            : }
     377                 :            : 
     378                 :            : //-----------------------------------------------------------------------------
     379                 :            : 
     380                 :       1938 : AxisLabelProperties::AxisLabelProperties()
     381                 :            :                         : m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() )
     382                 :            :                         , m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height )
     383                 :            :                         , nNumberFormatKey(0)
     384                 :            :                         , eStaggering( SIDE_BY_SIDE )
     385                 :            :                         , bLineBreakAllowed( false )
     386                 :            :                         , bOverlapAllowed( false )
     387                 :            :                         , bStackCharacters( false )
     388                 :            :                         , fRotationAngleDegree( 0.0 )
     389                 :            :                         , nRhythm( 1 )
     390                 :       1938 :                         , bRhythmIsFix(false)
     391                 :            : {
     392                 :            : 
     393                 :       1938 : }
     394                 :            : 
     395                 :       1776 : void AxisLabelProperties::init( const uno::Reference< XAxis >& xAxisModel )
     396                 :            : {
     397                 :            :     uno::Reference< beans::XPropertySet > xProp =
     398         [ +  - ]:       1776 :         uno::Reference<beans::XPropertySet>::query( xAxisModel );
     399         [ +  - ]:       1776 :     if(xProp.is())
     400                 :            :     {
     401                 :            :         try
     402                 :            :         {
     403 [ +  - ][ +  - ]:       1776 :             xProp->getPropertyValue( C2U( "TextBreak" ) ) >>= this->bLineBreakAllowed;
                 [ +  - ]
     404 [ +  - ][ +  - ]:       1776 :             xProp->getPropertyValue( C2U( "TextOverlap" ) ) >>= this->bOverlapAllowed;
                 [ +  - ]
     405 [ +  - ][ +  - ]:       1776 :             xProp->getPropertyValue( C2U( "StackCharacters" ) ) >>= this->bStackCharacters;
                 [ +  - ]
     406 [ +  - ][ +  - ]:       1776 :             xProp->getPropertyValue( C2U( "TextRotation" ) ) >>= this->fRotationAngleDegree;
                 [ +  - ]
     407                 :            : 
     408                 :            :             ::com::sun::star::chart::ChartAxisArrangeOrderType eArrangeOrder;
     409 [ +  - ][ +  - ]:       1776 :             xProp->getPropertyValue( C2U( "ArrangeOrder" ) ) >>= eArrangeOrder;
         [ +  - ][ #  # ]
                 [ +  - ]
     410   [ +  +  +  + ]:       1776 :             switch(eArrangeOrder)
     411                 :            :             {
     412                 :            :                 case ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
     413                 :        238 :                     this->eStaggering = SIDE_BY_SIDE;
     414                 :        238 :                     break;
     415                 :            :                 case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
     416                 :         16 :                     this->eStaggering = STAGGER_EVEN;
     417                 :         16 :                     break;
     418                 :            :                 case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
     419                 :         53 :                     this->eStaggering = STAGGER_ODD;
     420                 :         53 :                     break;
     421                 :            :                 default:
     422                 :       1469 :                     this->eStaggering = STAGGER_AUTO;
     423                 :       1776 :                     break;
     424                 :            :             }
     425                 :            :         }
     426         [ #  # ]:          0 :         catch( const uno::Exception& e )
     427                 :            :         {
     428                 :            :             ASSERT_EXCEPTION( e );
     429                 :            :         }
     430                 :       1776 :     }
     431                 :       1776 : }
     432                 :            : 
     433                 :       8558 : sal_Bool AxisLabelProperties::getIsStaggered() const
     434                 :            : {
     435 [ +  + ][ +  + ]:       8558 :     if( STAGGER_ODD == eStaggering || STAGGER_EVEN == eStaggering )
     436                 :       1837 :         return sal_True;
     437                 :       8558 :     return sal_False;
     438                 :            : }
     439                 :            : 
     440                 :            : //.............................................................................
     441                 :            : } //namespace chart
     442                 :            : //.............................................................................
     443                 :            : 
     444                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10