LCOV - code coverage report
Current view: top level - chart2/source/controller/itemsetwrapper - AxisItemConverter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 434 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1114 0.0 %

           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 "AxisItemConverter.hxx"
      21                 :            : #include "ItemPropertyMap.hxx"
      22                 :            : #include "CharacterPropertyItemConverter.hxx"
      23                 :            : #include "GraphicPropertyItemConverter.hxx"
      24                 :            : #include "chartview/ChartSfxItemIds.hxx"
      25                 :            : #include "chartview/ExplicitValueProvider.hxx"
      26                 :            : #include "SchWhichPairs.hxx"
      27                 :            : #include "macros.hxx"
      28                 :            : #include "ChartModelHelper.hxx"
      29                 :            : #include "AxisHelper.hxx"
      30                 :            : #include "CommonConverters.hxx"
      31                 :            : #include "ChartTypeHelper.hxx"
      32                 :            : 
      33                 :            : #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
      34                 :            : #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
      35                 :            : #include <com/sun/star/chart/ChartAxisPosition.hpp>
      36                 :            : #include <com/sun/star/chart2/XAxis.hpp>
      37                 :            : #include <com/sun/star/chart2/AxisOrientation.hpp>
      38                 :            : #include <com/sun/star/chart2/AxisType.hpp>
      39                 :            : 
      40                 :            : // for SfxBoolItem
      41                 :            : #include <svl/eitem.hxx>
      42                 :            : // for SvxDoubleItem
      43                 :            : #include <svx/chrtitem.hxx>
      44                 :            : // for SfxInt32Item
      45                 :            : #include <svl/intitem.hxx>
      46                 :            : #include <rtl/math.hxx>
      47                 :            : 
      48                 :            : #include <algorithm>
      49                 :            : 
      50                 :            : using namespace ::com::sun::star;
      51                 :            : using namespace ::com::sun::star::chart2;
      52                 :            : using ::com::sun::star::uno::Reference;
      53                 :            : using ::com::sun::star::chart::TimeInterval;
      54                 :            : using ::com::sun::star::chart::TimeIncrement;
      55                 :            : 
      56                 :            : namespace
      57                 :            : {
      58                 :          0 : ::comphelper::ItemPropertyMapType & lcl_GetAxisPropertyMap()
      59                 :            : {
      60                 :            :     static ::comphelper::ItemPropertyMapType aAxisPropertyMap(
      61                 :            :         ::comphelper::MakeItemPropertyMap
      62                 :            :         IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR,     "DisplayLabels",    0 )
      63 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS,         "MajorTickmarks",   0 )
         [ #  # ][ #  # ]
      64 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS,     "MinorTickmarks",   0 )
      65 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_ORDER,   "ArrangeOrder",     0 )
      66 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED,       "StackCharacters",  0 )
      67 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_BREAK,   "TextBreak",        0 )
      68 [ #  # ][ #  # ]:          0 :         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_OVERLAP, "TextOverlap",      0 )
      69 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
      70                 :            : 
      71                 :          0 :     return aAxisPropertyMap;
      72                 :            : };
      73                 :            : } // anonymous namespace
      74                 :            : 
      75                 :            : namespace chart
      76                 :            : {
      77                 :            : namespace wrapper
      78                 :            : {
      79                 :            : 
      80                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
      81                 :          0 : AxisItemConverter::AxisItemConverter(
      82                 :            :     const Reference< beans::XPropertySet > & rPropertySet,
      83                 :            :     SfxItemPool& rItemPool,
      84                 :            :     SdrModel& rDrawModel,
      85                 :            :     const Reference< chart2::XChartDocument > & xChartDoc,
      86                 :            :     ::chart::ExplicitScaleData * pScale /* = NULL */,
      87                 :            :     ::chart::ExplicitIncrementData * pIncrement /* = NULL */,
      88                 :            :     ::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) :
      89                 :            :         ItemConverter( rPropertySet, rItemPool ),
      90                 :            :         m_xChartDoc( xChartDoc ),
      91                 :            :         m_pExplicitScale( NULL ),
      92         [ #  # ]:          0 :         m_pExplicitIncrement( NULL )
      93                 :            : {
      94         [ #  # ]:          0 :     Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
      95                 :            : 
      96         [ #  # ]:          0 :     if( pScale )
      97 [ #  # ][ #  # ]:          0 :         m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale );
      98         [ #  # ]:          0 :     if( pIncrement )
      99 [ #  # ][ #  # ]:          0 :         m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement );
     100                 :            : 
     101                 :            :     m_aConverters.push_back( new GraphicPropertyItemConverter(
     102                 :            :                                  rPropertySet, rItemPool, rDrawModel,
     103                 :            :                                  xNamedPropertyContainerFactory,
     104 [ #  # ][ #  # ]:          0 :                                  GraphicPropertyItemConverter::LINE_PROPERTIES ));
                 [ #  # ]
     105                 :            :     m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
     106 [ #  # ][ #  # ]:          0 :                                                                  C2U( "ReferencePageSize" ) ));
         [ #  # ][ #  # ]
     107                 :            : 
     108 [ #  # ][ #  # ]:          0 :     m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
     109                 :          0 :     OSL_ASSERT( m_xAxis.is());
     110                 :          0 : }
     111                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     112                 :            : 
     113                 :          0 : AxisItemConverter::~AxisItemConverter()
     114                 :            : {
     115 [ #  # ][ #  # ]:          0 :     delete m_pExplicitScale;
     116         [ #  # ]:          0 :     delete m_pExplicitIncrement;
     117                 :            : 
     118                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
     119         [ #  # ]:          0 :                      ::comphelper::DeleteItemConverterPtr() );
     120         [ #  # ]:          0 : }
     121                 :            : 
     122                 :          0 : void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
     123                 :            : {
     124                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
     125         [ #  # ]:          0 :                      ::comphelper::FillItemSetFunc( rOutItemSet ));
     126                 :            : 
     127                 :            :     // own items
     128                 :          0 :     ItemConverter::FillItemSet( rOutItemSet );
     129                 :          0 : }
     130                 :            : 
     131                 :          0 : bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
     132                 :            : {
     133                 :          0 :     bool bResult = false;
     134                 :            : 
     135                 :            :     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
     136         [ #  # ]:          0 :                      ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
     137                 :            : 
     138                 :            :     // own items
     139 [ #  # ][ #  # ]:          0 :     return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
                 [ #  # ]
     140                 :            : }
     141                 :            : 
     142                 :          0 : const sal_uInt16 * AxisItemConverter::GetWhichPairs() const
     143                 :            : {
     144                 :            :     // must span all used items!
     145                 :          0 :     return nAxisWhichPairs;
     146                 :            : }
     147                 :            : 
     148                 :          0 : bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
     149                 :            : {
     150         [ #  # ]:          0 :     ::comphelper::ItemPropertyMapType & rMap( lcl_GetAxisPropertyMap());
     151         [ #  # ]:          0 :     ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
     152                 :            : 
     153         [ #  # ]:          0 :     if( aIt == rMap.end())
     154                 :          0 :         return false;
     155                 :            : 
     156                 :          0 :     rOutProperty =(*aIt).second;
     157                 :            : 
     158                 :          0 :     return true;
     159                 :            : }
     160                 :            : 
     161                 :          0 : bool lcl_hasTimeIntervalValue( const uno::Any& rAny )
     162                 :            : {
     163                 :          0 :     bool bRet = false;
     164                 :          0 :     TimeInterval aValue;
     165 [ #  # ][ #  # ]:          0 :     if( rAny >>= aValue )
     166                 :          0 :         bRet = true;
     167                 :          0 :     return bRet;
     168                 :            : }
     169                 :            : 
     170                 :          0 : void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
     171                 :            :     throw( uno::Exception )
     172                 :            : {
     173         [ #  # ]:          0 :     if( !m_xAxis.is() )
     174                 :          0 :         return;
     175                 :            : 
     176                 :          0 :     const chart2::ScaleData&     rScale( m_xAxis->getScaleData() );
     177                 :          0 :     const chart2::IncrementData& rIncrement( rScale.IncrementData );
     178                 :          0 :     const uno::Sequence< chart2::SubIncrement >& rSubIncrements( rScale.IncrementData.SubIncrements );
     179                 :          0 :     const TimeIncrement& rTimeIncrement( rScale.TimeIncrement );
     180                 :          0 :     bool bDateAxis = (chart2::AxisType::DATE == rScale.AxisType);
     181         [ #  # ]:          0 :     if( m_pExplicitScale )
     182                 :          0 :         bDateAxis = (chart2::AxisType::DATE == m_pExplicitScale->AxisType);
     183                 :            : 
     184   [ #  #  #  #  :          0 :     switch( nWhichId )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     185                 :            :     {
     186                 :            :         case SCHATTR_AXIS_AUTO_MAX:
     187 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Maximum) ) );
         [ #  # ][ #  # ]
     188                 :          0 :             break;
     189                 :            : 
     190                 :            :         case SCHATTR_AXIS_MAX:
     191                 :            :             {
     192                 :          0 :                 double fMax = 10.0;
     193         [ #  # ]:          0 :                 if( rScale.Maximum >>= fMax )
     194 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
                 [ #  # ]
     195                 :            :                 else
     196                 :            :                 {
     197         [ #  # ]:          0 :                     if( m_pExplicitScale )
     198                 :          0 :                         fMax = m_pExplicitScale->Maximum;
     199 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
                 [ #  # ]
     200                 :            :                 }
     201                 :            :             }
     202                 :          0 :             break;
     203                 :            : 
     204                 :            :         case SCHATTR_AXIS_AUTO_MIN:
     205 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Minimum) ) );
         [ #  # ][ #  # ]
     206                 :          0 :             break;
     207                 :            : 
     208                 :            :         case SCHATTR_AXIS_MIN:
     209                 :            :             {
     210                 :          0 :                 double fMin = 0.0;
     211         [ #  # ]:          0 :                 if( rScale.Minimum >>= fMin )
     212 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
                 [ #  # ]
     213         [ #  # ]:          0 :                 else if( m_pExplicitScale )
     214 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
                 [ #  # ]
     215                 :            :             }
     216                 :          0 :             break;
     217                 :            : 
     218                 :            :         case SCHATTR_AXIS_LOGARITHM:
     219                 :            :             {
     220         [ #  # ]:          0 :                 sal_Bool bValue = AxisHelper::isLogarithmic( rScale.Scaling );
     221 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
                 [ #  # ]
     222                 :            :             }
     223                 :          0 :             break;
     224                 :            : 
     225                 :            :         case SCHATTR_AXIS_REVERSE:
     226 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == rScale.Orientation) ));
                 [ #  # ]
     227                 :          0 :             break;
     228                 :            : 
     229                 :            :         // Increment
     230                 :            :         case SCHATTR_AXIS_AUTO_STEP_MAIN:
     231         [ #  # ]:          0 :             if( bDateAxis )
     232 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MajorTimeInterval) ) );
         [ #  # ][ #  # ]
     233                 :            :             else
     234 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rIncrement.Distance) ) );
         [ #  # ][ #  # ]
     235                 :          0 :             break;
     236                 :            : 
     237                 :            :         case SCHATTR_AXIS_MAIN_TIME_UNIT:
     238                 :            :             {
     239                 :          0 :                 TimeInterval aTimeInterval;
     240 [ #  # ][ #  # ]:          0 :                 if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
     241 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
                 [ #  # ]
     242         [ #  # ]:          0 :                 else if( m_pExplicitIncrement )
     243 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MajorTimeInterval.TimeUnit ) );
                 [ #  # ]
     244                 :            :             }
     245                 :          0 :             break;
     246                 :            : 
     247                 :            :         case SCHATTR_AXIS_STEP_MAIN:
     248         [ #  # ]:          0 :             if( bDateAxis )
     249                 :            :             {
     250                 :          0 :                 TimeInterval aTimeInterval;
     251 [ #  # ][ #  # ]:          0 :                 if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
     252 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, nWhichId ));
                 [ #  # ]
     253         [ #  # ]:          0 :                 else if( m_pExplicitIncrement )
     254 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, nWhichId ));
                 [ #  # ]
     255                 :            :             }
     256                 :            :             else
     257                 :            :             {
     258                 :          0 :                 double fDistance = 1.0;
     259         [ #  # ]:          0 :                 if( rIncrement.Distance >>= fDistance )
     260 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
                 [ #  # ]
     261         [ #  # ]:          0 :                 else if( m_pExplicitIncrement )
     262 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
                 [ #  # ]
     263                 :            :             }
     264                 :          0 :             break;
     265                 :            : 
     266                 :            :         // SubIncrement
     267                 :            :         case SCHATTR_AXIS_AUTO_STEP_HELP:
     268         [ #  # ]:          0 :             if( bDateAxis )
     269 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MinorTimeInterval) ) );
         [ #  # ][ #  # ]
     270                 :            :             else
     271                 :            :                 rOutItemSet.Put( SfxBoolItem( nWhichId,
     272 [ #  # ][ #  # ]:          0 :                     ! ( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue() )));
         [ #  # ][ #  # ]
                 [ #  # ]
     273                 :          0 :             break;
     274                 :            : 
     275                 :            :         case SCHATTR_AXIS_HELP_TIME_UNIT:
     276                 :            :             {
     277                 :          0 :                 TimeInterval aTimeInterval;
     278 [ #  # ][ #  # ]:          0 :                 if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
     279 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
                 [ #  # ]
     280         [ #  # ]:          0 :                 else if( m_pExplicitIncrement )
     281 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.TimeUnit ) );
                 [ #  # ]
     282                 :            :             }
     283                 :          0 :             break;
     284                 :            : 
     285                 :            :         case SCHATTR_AXIS_STEP_HELP:
     286         [ #  # ]:          0 :             if( bDateAxis )
     287                 :            :             {
     288                 :          0 :                 TimeInterval aTimeInterval;
     289 [ #  # ][ #  # ]:          0 :                 if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
     290 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.Number ));
                 [ #  # ]
     291         [ #  # ]:          0 :                 else if( m_pExplicitIncrement )
     292 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.Number ));
                 [ #  # ]
     293                 :            :             }
     294                 :            :             else
     295                 :            :             {
     296 [ #  # ][ #  # ]:          0 :                 if( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue())
                 [ #  # ]
     297                 :            :                 {
     298                 :            :                     OSL_ASSERT( rSubIncrements[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
     299                 :            :                     rOutItemSet.Put( SfxInt32Item( nWhichId,
     300                 :            :                             *reinterpret_cast< const sal_Int32 * >(
     301 [ #  # ][ #  # ]:          0 :                                 rSubIncrements[0].IntervalCount.getValue()) ));
                 [ #  # ]
     302                 :            :                 }
     303                 :            :                 else
     304                 :            :                 {
     305 [ #  # ][ #  # ]:          0 :                     if( m_pExplicitIncrement && !m_pExplicitIncrement->SubIncrements.empty() )
                 [ #  # ]
     306                 :            :                     {
     307                 :            :                         rOutItemSet.Put( SfxInt32Item( nWhichId,
     308 [ #  # ][ #  # ]:          0 :                                 m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
         [ #  # ][ #  # ]
     309                 :            :                     }
     310                 :            :                 }
     311                 :            :             }
     312                 :          0 :             break;
     313                 :            : 
     314                 :            :         case SCHATTR_AXIS_AUTO_TIME_RESOLUTION:
     315                 :            :             {
     316                 :            :                 rOutItemSet.Put( SfxBoolItem( nWhichId,
     317 [ #  # ][ #  # ]:          0 :                         !rTimeIncrement.TimeResolution.hasValue() ));
                 [ #  # ]
     318                 :            :             }
     319                 :          0 :             break;
     320                 :            :         case SCHATTR_AXIS_TIME_RESOLUTION:
     321                 :            :             {
     322                 :          0 :                 long nTimeResolution=0;
     323         [ #  # ]:          0 :                 if( rTimeIncrement.TimeResolution >>= nTimeResolution )
     324 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) );
                 [ #  # ]
     325         [ #  # ]:          0 :                 else if( m_pExplicitScale )
     326 [ #  # ][ #  # ]:          0 :                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitScale->TimeResolution ) );
                 [ #  # ]
     327                 :            :             }
     328                 :          0 :             break;
     329                 :            : 
     330                 :            :         case SCHATTR_AXIS_AUTO_ORIGIN:
     331                 :            :         {
     332 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(rScale.Origin) )));
         [ #  # ][ #  # ]
     333                 :            :         }
     334                 :          0 :         break;
     335                 :            : 
     336                 :            :         case SCHATTR_AXIS_ORIGIN:
     337                 :            :         {
     338                 :          0 :             double fOrigin = 0.0;
     339         [ #  # ]:          0 :             if( !(rScale.Origin >>= fOrigin) )
     340                 :            :             {
     341         [ #  # ]:          0 :                 if( m_pExplicitScale )
     342                 :          0 :                     fOrigin = m_pExplicitScale->Origin;
     343                 :            :             }
     344 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SvxDoubleItem( fOrigin, nWhichId ));
                 [ #  # ]
     345                 :            :         }
     346                 :          0 :         break;
     347                 :            : 
     348                 :            :         case SCHATTR_AXIS_POSITION:
     349                 :            :         {
     350                 :          0 :             ::com::sun::star::chart::ChartAxisPosition eAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
     351 [ #  # ][ #  # ]:          0 :             GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eAxisPos;
         [ #  # ][ #  # ]
                 [ #  # ]
     352 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxInt32Item( nWhichId, eAxisPos ) );
                 [ #  # ]
     353                 :            :         }
     354                 :          0 :         break;
     355                 :            : 
     356                 :            :         case SCHATTR_AXIS_POSITION_VALUE:
     357                 :            :         {
     358                 :          0 :             double fValue = 0.0;
     359 [ #  # ][ #  # ]:          0 :             if( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue )
         [ #  # ][ #  # ]
                 [ #  # ]
     360 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SvxDoubleItem( fValue, nWhichId ) );
                 [ #  # ]
     361                 :            :         }
     362                 :          0 :         break;
     363                 :            : 
     364                 :            :         case SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT:
     365                 :            :         {
     366                 :            :             //read only item
     367                 :            :             //necessary tp display the crossing value with an appropriate format
     368                 :            : 
     369                 :            :             Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
     370 [ #  # ][ #  # ]:          0 :                 m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     371                 :            : 
     372         [ #  # ]:          0 :             Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
     373                 :            : 
     374                 :            :             sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
     375 [ #  # ][ #  # ]:          0 :                 xCrossingMainAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
     376                 :            : 
     377 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
                 [ #  # ]
     378                 :            :         }
     379                 :          0 :         break;
     380                 :            : 
     381                 :            :         case SCHATTR_AXIS_LABEL_POSITION:
     382                 :            :         {
     383                 :          0 :             ::com::sun::star::chart::ChartAxisLabelPosition ePos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
     384 [ #  # ][ #  # ]:          0 :             GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= ePos;
         [ #  # ][ #  # ]
                 [ #  # ]
     385 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
                 [ #  # ]
     386                 :            :         }
     387                 :          0 :         break;
     388                 :            : 
     389                 :            :         case SCHATTR_AXIS_MARK_POSITION:
     390                 :            :         {
     391                 :          0 :             ::com::sun::star::chart::ChartAxisMarkPosition ePos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
     392 [ #  # ][ #  # ]:          0 :             GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= ePos;
         [ #  # ][ #  # ]
                 [ #  # ]
     393 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
                 [ #  # ]
     394                 :            :         }
     395                 :          0 :         break;
     396                 :            : 
     397                 :            :         case SCHATTR_TEXT_DEGREES:
     398                 :            :         {
     399                 :            :             // convert double to int (times 100)
     400                 :          0 :             double fVal = 0;
     401                 :            : 
     402 [ #  # ][ #  # ]:          0 :             if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
         [ #  # ][ #  # ]
                 [ #  # ]
     403                 :            :             {
     404                 :            :                 rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
     405 [ #  # ][ #  # ]:          0 :                                                    ::rtl::math::round( fVal * 100.0 ) ) ));
                 [ #  # ]
     406                 :            :             }
     407                 :            :         }
     408                 :          0 :         break;
     409                 :            : 
     410                 :            :         case SID_ATTR_NUMBERFORMAT_VALUE:
     411                 :            :         {
     412         [ #  # ]:          0 :             if( m_pExplicitScale )
     413                 :            :             {
     414                 :            :                 Reference< chart2::XCoordinateSystem > xCooSys(
     415                 :            :                         AxisHelper::getCoordinateSystemOfAxis(
     416 [ #  # ][ #  # ]:          0 :                               m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     417                 :            : 
     418                 :            :                 sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
     419 [ #  # ][ #  # ]:          0 :                     m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
     420                 :            : 
     421 [ #  # ][ #  # ]:          0 :                 rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
                 [ #  # ]
     422                 :            :             }
     423                 :            :         }
     424                 :          0 :         break;
     425                 :            : 
     426                 :            :         case SID_ATTR_NUMBERFORMAT_SOURCE:
     427                 :            :         {
     428 [ #  # ][ #  # ]:          0 :             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
         [ #  # ][ #  # ]
     429 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
                 [ #  # ]
     430                 :            :         }
     431                 :          0 :         break;
     432                 :            : 
     433                 :            :         case SCHATTR_AXISTYPE:
     434 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxInt32Item( nWhichId, rScale.AxisType ));
                 [ #  # ]
     435                 :          0 :         break;
     436                 :            : 
     437                 :            :         case SCHATTR_AXIS_AUTO_DATEAXIS:
     438 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxBoolItem( nWhichId, rScale.AutoDateAxis ));
                 [ #  # ]
     439                 :          0 :         break;
     440                 :            : 
     441                 :            :         case SCHATTR_AXIS_ALLOW_DATEAXIS:
     442                 :            :         {
     443                 :            :             Reference< chart2::XCoordinateSystem > xCooSys(
     444 [ #  # ][ #  # ]:          0 :                 AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     445                 :          0 :             sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
     446         [ #  # ]:          0 :             AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex );
     447 [ #  # ][ #  # ]:          0 :             bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), 2, nDimensionIndex );
     448 [ #  # ][ #  # ]:          0 :             rOutItemSet.Put( SfxBoolItem( nWhichId, bChartTypeAllowsDateAxis ));
                 [ #  # ]
     449                 :            :         }
     450                 :          0 :         break;
     451                 :          0 :     }
     452                 :            : }
     453                 :            : 
     454                 :          0 : bool lcl_isDateAxis( const SfxItemSet & rItemSet )
     455                 :            : {
     456                 :          0 :     sal_Int32 nAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( SCHATTR_AXISTYPE )).GetValue();//::com::sun::star::chart2::AxisType
     457                 :          0 :     return (chart2::AxisType::DATE == nAxisType);
     458                 :            : }
     459                 :            : 
     460                 :          0 : bool lcl_isAutoMajor( const SfxItemSet & rItemSet )
     461                 :            : {
     462                 :          0 :     bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue();
     463                 :          0 :     return bRet;
     464                 :            : }
     465                 :            : 
     466                 :          0 : bool lcl_isAutoMinor( const SfxItemSet & rItemSet )
     467                 :            : {
     468                 :          0 :     bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue();
     469                 :          0 :     return bRet;
     470                 :            : }
     471                 :            : 
     472                 :          0 : bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
     473                 :            :     throw( uno::Exception )
     474                 :            : {
     475         [ #  # ]:          0 :     if( !m_xAxis.is() )
     476                 :          0 :         return false;
     477                 :            : 
     478 [ #  # ][ #  # ]:          0 :     chart2::ScaleData     aScale( m_xAxis->getScaleData() );
     479                 :            : 
     480                 :          0 :     bool bSetScale    = false;
     481                 :          0 :     bool bChangedOtherwise = false;
     482                 :            : 
     483                 :          0 :     uno::Any aValue;
     484                 :            : 
     485   [ #  #  #  #  :          0 :     switch( nWhichId )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     486                 :            :     {
     487                 :            :         case SCHATTR_AXIS_AUTO_MAX:
     488         [ #  # ]:          0 :             if( (static_cast< const SfxBoolItem & >(
     489         [ #  # ]:          0 :                      rItemSet.Get( nWhichId )).GetValue() ))
     490                 :            :             {
     491                 :          0 :                 aScale.Maximum.clear();
     492                 :          0 :                 bSetScale = true;
     493                 :            :             }
     494                 :            :             // else SCHATTR_AXIS_MAX must have some value
     495                 :          0 :             break;
     496                 :            : 
     497                 :            :         case SCHATTR_AXIS_MAX:
     498                 :            :             // only if auto if false
     499         [ #  # ]:          0 :             if( ! (static_cast< const SfxBoolItem & >(
     500         [ #  # ]:          0 :                        rItemSet.Get( SCHATTR_AXIS_AUTO_MAX )).GetValue() ))
     501                 :            :             {
     502 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     503                 :            : 
     504         [ #  # ]:          0 :                 if( aScale.Maximum != aValue )
     505                 :            :                 {
     506                 :          0 :                     aScale.Maximum = aValue;
     507                 :          0 :                     bSetScale = true;
     508                 :            :                 }
     509                 :            :             }
     510                 :          0 :             break;
     511                 :            : 
     512                 :            :         case SCHATTR_AXIS_AUTO_MIN:
     513         [ #  # ]:          0 :             if( (static_cast< const SfxBoolItem & >(
     514         [ #  # ]:          0 :                      rItemSet.Get( nWhichId )).GetValue() ))
     515                 :            :             {
     516                 :          0 :                 aScale.Minimum.clear();
     517                 :          0 :                 bSetScale = true;
     518                 :            :             }
     519                 :            :             // else SCHATTR_AXIS_MIN must have some value
     520                 :          0 :             break;
     521                 :            : 
     522                 :            :         case SCHATTR_AXIS_MIN:
     523                 :            :             // only if auto if false
     524         [ #  # ]:          0 :             if( ! (static_cast< const SfxBoolItem & >(
     525         [ #  # ]:          0 :                        rItemSet.Get( SCHATTR_AXIS_AUTO_MIN )).GetValue() ))
     526                 :            :             {
     527 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     528                 :            : 
     529         [ #  # ]:          0 :                 if( aScale.Minimum != aValue )
     530                 :            :                 {
     531                 :          0 :                     aScale.Minimum = aValue;
     532                 :          0 :                     bSetScale = true;
     533                 :            :                 }
     534                 :            :             }
     535                 :          0 :             break;
     536                 :            : 
     537                 :            :         case SCHATTR_AXIS_LOGARITHM:
     538                 :            :         {
     539         [ #  # ]:          0 :             bool bWasLogarithm = AxisHelper::isLogarithmic( aScale.Scaling );
     540                 :            : 
     541         [ #  # ]:          0 :             if( (static_cast< const SfxBoolItem & >(
     542         [ #  # ]:          0 :                      rItemSet.Get( nWhichId )).GetValue() ))
     543                 :            :             {
     544                 :            :                 // logarithm is true
     545         [ #  # ]:          0 :                 if( ! bWasLogarithm )
     546                 :            :                 {
     547 [ #  # ][ #  # ]:          0 :                     aScale.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
     548                 :          0 :                     bSetScale = true;
     549                 :            :                 }
     550                 :            :             }
     551                 :            :             else
     552                 :            :             {
     553                 :            :                 // logarithm is false => linear scaling
     554         [ #  # ]:          0 :                 if( bWasLogarithm )
     555                 :            :                 {
     556 [ #  # ][ #  # ]:          0 :                     aScale.Scaling = AxisHelper::createLinearScaling();
     557                 :          0 :                     bSetScale = true;
     558                 :            :                 }
     559                 :            :             }
     560                 :            :         }
     561                 :          0 :         break;
     562                 :            : 
     563                 :            :         case SCHATTR_AXIS_REVERSE:
     564                 :            :         {
     565                 :          0 :             bool bWasReverse = ( AxisOrientation_REVERSE == aScale.Orientation );
     566                 :            :             bool bNewReverse = (static_cast< const SfxBoolItem & >(
     567         [ #  # ]:          0 :                      rItemSet.Get( nWhichId )).GetValue() );
     568         [ #  # ]:          0 :             if( bWasReverse != bNewReverse )
     569                 :            :             {
     570         [ #  # ]:          0 :                 aScale.Orientation = bNewReverse ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
     571                 :          0 :                 bSetScale = true;
     572                 :            :             }
     573                 :            :         }
     574                 :          0 :         break;
     575                 :            : 
     576                 :            :         // Increment
     577                 :            :         case SCHATTR_AXIS_AUTO_STEP_MAIN:
     578 [ #  # ][ #  # ]:          0 :             if( lcl_isAutoMajor(rItemSet) )
     579                 :            :             {
     580                 :          0 :                 aScale.IncrementData.Distance.clear();
     581                 :          0 :                 aScale.TimeIncrement.MajorTimeInterval.clear();
     582                 :          0 :                 bSetScale = true;
     583                 :            :             }
     584                 :            :             // else SCHATTR_AXIS_STEP_MAIN must have some value
     585                 :          0 :             break;
     586                 :            : 
     587                 :            :         case SCHATTR_AXIS_MAIN_TIME_UNIT:
     588 [ #  # ][ #  # ]:          0 :             if( !lcl_isAutoMajor(rItemSet) )
     589                 :            :             {
     590 [ #  # ][ #  # ]:          0 :                 if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
                 [ #  # ]
     591                 :            :                 {
     592                 :          0 :                     TimeInterval aTimeInterval;
     593         [ #  # ]:          0 :                     aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
     594                 :          0 :                     aValue >>= aTimeInterval.TimeUnit;
     595         [ #  # ]:          0 :                     aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
     596                 :          0 :                     bSetScale = true;
     597                 :            :                 }
     598                 :            :             }
     599                 :          0 :             break;
     600                 :            : 
     601                 :            :         case SCHATTR_AXIS_STEP_MAIN:
     602                 :            :             // only if auto if false
     603 [ #  # ][ #  # ]:          0 :             if( !lcl_isAutoMajor(rItemSet) )
     604                 :            :             {
     605 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     606 [ #  # ][ #  # ]:          0 :                 if( lcl_isDateAxis(rItemSet) )
     607                 :            :                 {
     608                 :          0 :                     double fValue = 1.0;
     609         [ #  # ]:          0 :                     if( aValue >>= fValue )
     610                 :            :                     {
     611                 :          0 :                         TimeInterval aTimeInterval;
     612         [ #  # ]:          0 :                         aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
     613                 :          0 :                         aTimeInterval.Number = static_cast<sal_Int32>(fValue);
     614         [ #  # ]:          0 :                         aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
     615                 :          0 :                         bSetScale = true;
     616                 :            :                     }
     617                 :            :                 }
     618         [ #  # ]:          0 :                 else if( aScale.IncrementData.Distance != aValue )
     619                 :            :                 {
     620                 :          0 :                     aScale.IncrementData.Distance = aValue;
     621                 :          0 :                     bSetScale = true;
     622                 :            :                 }
     623                 :            :             }
     624                 :          0 :             break;
     625                 :            : 
     626                 :            :         // SubIncrement
     627                 :            :         case SCHATTR_AXIS_AUTO_STEP_HELP:
     628 [ #  # ][ #  # ]:          0 :             if( lcl_isAutoMinor(rItemSet) )
     629                 :            :             {
     630   [ #  #  #  # ]:          0 :                 if( aScale.IncrementData.SubIncrements.getLength() > 0 &&
                 [ #  # ]
     631         [ #  # ]:          0 :                     aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
     632                 :            :                 {
     633         [ #  # ]:          0 :                         aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
     634                 :          0 :                         bSetScale = true;
     635                 :            :                 }
     636         [ #  # ]:          0 :                 if( aScale.TimeIncrement.MinorTimeInterval.hasValue() )
     637                 :            :                 {
     638                 :          0 :                     aScale.TimeIncrement.MinorTimeInterval.clear();
     639                 :          0 :                     bSetScale = true;
     640                 :            :                 }
     641                 :            :             }
     642                 :            :             // else SCHATTR_AXIS_STEP_MAIN must have some value
     643                 :          0 :             break;
     644                 :            : 
     645                 :            :         case SCHATTR_AXIS_HELP_TIME_UNIT:
     646 [ #  # ][ #  # ]:          0 :             if( !lcl_isAutoMinor(rItemSet) )
     647                 :            :             {
     648 [ #  # ][ #  # ]:          0 :                 if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
                 [ #  # ]
     649                 :            :                 {
     650                 :          0 :                     TimeInterval aTimeInterval;
     651         [ #  # ]:          0 :                     aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
     652                 :          0 :                     aValue >>= aTimeInterval.TimeUnit;
     653         [ #  # ]:          0 :                     aScale.TimeIncrement.MinorTimeInterval = uno::makeAny( aTimeInterval );
     654                 :          0 :                     bSetScale = true;
     655                 :            :                 }
     656                 :            :             }
     657                 :          0 :             break;
     658                 :            : 
     659                 :            :         case SCHATTR_AXIS_STEP_HELP:
     660                 :            :             // only if auto is false
     661 [ #  # ][ #  # ]:          0 :             if( !lcl_isAutoMinor(rItemSet) )
     662                 :            :             {
     663 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     664 [ #  # ][ #  # ]:          0 :                 if( lcl_isDateAxis(rItemSet) )
     665                 :            :                 {
     666                 :          0 :                     TimeInterval aTimeInterval;
     667         [ #  # ]:          0 :                     aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
     668                 :          0 :                     aValue >>= aTimeInterval.Number;
     669         [ #  # ]:          0 :                     aScale.TimeIncrement.MinorTimeInterval = uno::makeAny(aTimeInterval);
     670                 :          0 :                     bSetScale = true;
     671                 :            :                 }
     672         [ #  # ]:          0 :                 else if( aScale.IncrementData.SubIncrements.getLength() > 0 )
     673                 :            :                 {
     674         [ #  # ]:          0 :                     if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ||
           [ #  #  #  # ]
                 [ #  # ]
     675         [ #  # ]:          0 :                         aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
     676                 :            :                     {
     677                 :            :                         OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
     678         [ #  # ]:          0 :                         aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
     679                 :          0 :                         bSetScale = true;
     680                 :            :                     }
     681                 :            :                 }
     682                 :            :             }
     683                 :          0 :             break;
     684                 :            : 
     685                 :            :         case SCHATTR_AXIS_AUTO_TIME_RESOLUTION:
     686 [ #  # ][ #  # ]:          0 :             if( (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() ))
     687                 :            :             {
     688                 :          0 :                 aScale.TimeIncrement.TimeResolution.clear();
     689                 :          0 :                 bSetScale = true;
     690                 :            :             }
     691                 :          0 :             break;
     692                 :            :         case SCHATTR_AXIS_TIME_RESOLUTION:
     693                 :            :             // only if auto is false
     694 [ #  # ][ #  # ]:          0 :             if( ! (static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_TIME_RESOLUTION )).GetValue() ))
     695                 :            :             {
     696 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     697                 :            : 
     698         [ #  # ]:          0 :                 if( aScale.TimeIncrement.TimeResolution != aValue )
     699                 :            :                 {
     700                 :          0 :                     aScale.TimeIncrement.TimeResolution = aValue;
     701                 :          0 :                     bSetScale = true;
     702                 :            :                 }
     703                 :            :             }
     704                 :          0 :             break;
     705                 :            : 
     706                 :            : 
     707                 :            :         case SCHATTR_AXIS_AUTO_ORIGIN:
     708                 :            :         {
     709         [ #  # ]:          0 :             if( (static_cast< const SfxBoolItem & >(
     710         [ #  # ]:          0 :                      rItemSet.Get( nWhichId )).GetValue() ))
     711                 :            :             {
     712                 :          0 :                 aScale.Origin.clear();
     713                 :          0 :                 bSetScale = true;
     714                 :            :             }
     715                 :            :         }
     716                 :          0 :         break;
     717                 :            : 
     718                 :            :         case SCHATTR_AXIS_ORIGIN:
     719                 :            :         {
     720                 :            :             // only if auto is false
     721         [ #  # ]:          0 :             if( ! (static_cast< const SfxBoolItem & >(
     722         [ #  # ]:          0 :                        rItemSet.Get( SCHATTR_AXIS_AUTO_ORIGIN )).GetValue() ))
     723                 :            :             {
     724 [ #  # ][ #  # ]:          0 :                 rItemSet.Get( nWhichId ).QueryValue( aValue );
     725                 :            : 
     726         [ #  # ]:          0 :                 if( aScale.Origin != aValue )
     727                 :            :                 {
     728                 :          0 :                     aScale.Origin = aValue;
     729                 :          0 :                     bSetScale = true;
     730                 :            : 
     731 [ #  # ][ #  # ]:          0 :                     if( !AxisHelper::isAxisPositioningEnabled() )
     732                 :            :                     {
     733                 :            :                         //keep old and new settings for axis positioning in sync somehow
     734                 :            :                         Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
     735 [ #  # ][ #  # ]:          0 :                             m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     736                 :            : 
     737                 :          0 :                         sal_Int32 nDimensionIndex=0;
     738                 :          0 :                         sal_Int32 nAxisIndex=0;
     739 [ #  # ][ #  # ]:          0 :                         if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 )
         [ #  # ][ #  # ]
     740                 :            :                         {
     741 [ #  # ][ #  # ]:          0 :                             Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ), uno::UNO_QUERY );
     742         [ #  # ]:          0 :                             if( xCrossingMainAxis.is() )
     743                 :            :                             {
     744                 :          0 :                                 double fValue = 0.0;
     745         [ #  # ]:          0 :                                 if( aValue >>= fValue )
     746                 :            :                                 {
     747 [ #  # ][ #  # ]:          0 :                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE ));
         [ #  # ][ #  # ]
     748 [ #  # ][ #  # ]:          0 :                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
         [ #  # ][ #  # ]
     749                 :            :                                 }
     750                 :            :                                 else
     751 [ #  # ][ #  # ]:          0 :                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START ));
         [ #  # ][ #  # ]
     752                 :          0 :                             }
     753                 :          0 :                         }
     754                 :            :                     }
     755                 :            :                 }
     756                 :            :             }
     757                 :            :         }
     758                 :          0 :         break;
     759                 :            : 
     760                 :            :         case SCHATTR_AXIS_POSITION:
     761                 :            :         {
     762                 :            :             ::com::sun::star::chart::ChartAxisPosition eAxisPos =
     763                 :            :                 (::com::sun::star::chart::ChartAxisPosition)
     764         [ #  # ]:          0 :                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
     765                 :            : 
     766                 :          0 :             ::com::sun::star::chart::ChartAxisPosition eOldAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
     767 [ #  # ][ #  # ]:          0 :             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eOldAxisPos );
         [ #  # ][ #  # ]
                 [ #  # ]
     768                 :            : 
     769 [ #  # ][ #  # ]:          0 :             if( !bPropExisted || ( eOldAxisPos != eAxisPos ))
     770                 :            :             {
     771 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eAxisPos ));
         [ #  # ][ #  # ]
                 [ #  # ]
     772                 :          0 :                 bChangedOtherwise = true;
     773                 :            : 
     774                 :            :                 //move the parallel axes to the other side if necessary
     775 [ #  # ][ #  # ]:          0 :                 if( eAxisPos==::com::sun::star::chart::ChartAxisPosition_START || eAxisPos==::com::sun::star::chart::ChartAxisPosition_END )
     776                 :            :                 {
     777 [ #  # ][ #  # ]:          0 :                     Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
                 [ #  # ]
     778         [ #  # ]:          0 :                     if( xParallelAxis.is() )
     779                 :            :                     {
     780                 :            :                         ::com::sun::star::chart::ChartAxisPosition eOtherPos;
     781 [ #  # ][ #  # ]:          0 :                         if( xParallelAxis->getPropertyValue( C2U( "CrossoverPosition" ) ) >>= eOtherPos )
         [ #  # ][ #  # ]
                 [ #  # ]
     782                 :            :                         {
     783         [ #  # ]:          0 :                             if( eOtherPos == eAxisPos )
     784                 :            :                             {
     785                 :            :                                 ::com::sun::star::chart::ChartAxisPosition eOppositePos =
     786                 :            :                                     (eAxisPos==::com::sun::star::chart::ChartAxisPosition_START)
     787                 :            :                                     ? ::com::sun::star::chart::ChartAxisPosition_END
     788         [ #  # ]:          0 :                                     : ::com::sun::star::chart::ChartAxisPosition_START;
     789 [ #  # ][ #  # ]:          0 :                                 xParallelAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eOppositePos ));
         [ #  # ][ #  # ]
     790                 :            :                             }
     791                 :            :                         }
     792                 :          0 :                     }
     793                 :            :                 }
     794                 :            :             }
     795                 :            :         }
     796                 :          0 :         break;
     797                 :            : 
     798                 :            :         case SCHATTR_AXIS_POSITION_VALUE:
     799                 :            :         {
     800         [ #  # ]:          0 :             double fValue = static_cast< const SvxDoubleItem & >( rItemSet.Get( nWhichId )).GetValue();
     801                 :            : 
     802                 :          0 :             double fOldValue = 0.0;
     803 [ #  # ][ #  # ]:          0 :             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fOldValue );
         [ #  # ][ #  # ]
     804                 :            : 
     805 [ #  # ][ #  # ]:          0 :             if( !bPropExisted || ( fOldValue != fValue ))
     806                 :            :             {
     807 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
         [ #  # ][ #  # ]
                 [ #  # ]
     808                 :          0 :                 bChangedOtherwise = true;
     809                 :            : 
     810                 :            :                 //keep old and new settings for axis positioning in sync somehow
     811                 :            :                 {
     812                 :            :                     Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
     813 [ #  # ][ #  # ]:          0 :                         m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     814                 :            : 
     815                 :          0 :                     sal_Int32 nDimensionIndex=0;
     816                 :          0 :                     sal_Int32 nAxisIndex=0;
     817 [ #  # ][ #  # ]:          0 :                     if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 && nDimensionIndex==0 )
         [ #  # ][ #  # ]
                 [ #  # ]
     818                 :            :                     {
     819         [ #  # ]:          0 :                         Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
     820         [ #  # ]:          0 :                         if( xCrossingMainAxis.is() )
     821                 :            :                         {
     822 [ #  # ][ #  # ]:          0 :                             ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
     823         [ #  # ]:          0 :                             aCrossingScale.Origin = uno::makeAny(fValue);
     824 [ #  # ][ #  # ]:          0 :                             xCrossingMainAxis->setScaleData(aCrossingScale);
                 [ #  # ]
     825                 :          0 :                         }
     826                 :          0 :                     }
     827                 :            :                 }
     828                 :            :             }
     829                 :            :         }
     830                 :          0 :         break;
     831                 :            : 
     832                 :            :         case SCHATTR_AXIS_LABEL_POSITION:
     833                 :            :         {
     834                 :            :             ::com::sun::star::chart::ChartAxisLabelPosition ePos =
     835                 :            :                 (::com::sun::star::chart::ChartAxisLabelPosition)
     836         [ #  # ]:          0 :                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
     837                 :            : 
     838                 :          0 :             ::com::sun::star::chart::ChartAxisLabelPosition eOldPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
     839 [ #  # ][ #  # ]:          0 :             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= eOldPos );
         [ #  # ][ #  # ]
                 [ #  # ]
     840                 :            : 
     841 [ #  # ][ #  # ]:          0 :             if( !bPropExisted || ( eOldPos != ePos ))
     842                 :            :             {
     843 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( ePos ));
         [ #  # ][ #  # ]
                 [ #  # ]
     844                 :          0 :                 bChangedOtherwise = true;
     845                 :            : 
     846                 :            :                 //move the parallel axes to the other side if necessary
     847 [ #  # ][ #  # ]:          0 :                 if( ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START || ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END )
     848                 :            :                 {
     849 [ #  # ][ #  # ]:          0 :                     Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
                 [ #  # ]
     850         [ #  # ]:          0 :                     if( xParallelAxis.is() )
     851                 :            :                     {
     852                 :            :                         ::com::sun::star::chart::ChartAxisLabelPosition eOtherPos;
     853 [ #  # ][ #  # ]:          0 :                         if( xParallelAxis->getPropertyValue( C2U( "LabelPosition" ) ) >>= eOtherPos )
         [ #  # ][ #  # ]
                 [ #  # ]
     854                 :            :                         {
     855         [ #  # ]:          0 :                             if( eOtherPos == ePos )
     856                 :            :                             {
     857                 :            :                                 ::com::sun::star::chart::ChartAxisLabelPosition eOppositePos =
     858                 :            :                                     (ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START)
     859                 :            :                                     ? ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END
     860         [ #  # ]:          0 :                                     : ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START;
     861 [ #  # ][ #  # ]:          0 :                                 xParallelAxis->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( eOppositePos ));
         [ #  # ][ #  # ]
     862                 :            :                             }
     863                 :            :                         }
     864                 :          0 :                     }
     865                 :            :                 }
     866                 :            :             }
     867                 :            :         }
     868                 :          0 :         break;
     869                 :            : 
     870                 :            :         case SCHATTR_AXIS_MARK_POSITION:
     871                 :            :         {
     872                 :            :             ::com::sun::star::chart::ChartAxisMarkPosition ePos =
     873                 :            :                 (::com::sun::star::chart::ChartAxisMarkPosition)
     874         [ #  # ]:          0 :                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
     875                 :            : 
     876                 :          0 :             ::com::sun::star::chart::ChartAxisMarkPosition eOldPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
     877 [ #  # ][ #  # ]:          0 :             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= eOldPos );
         [ #  # ][ #  # ]
                 [ #  # ]
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :             if( !bPropExisted || ( eOldPos != ePos ))
     880                 :            :             {
     881 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "MarkPosition" ), uno::makeAny( ePos ));
         [ #  # ][ #  # ]
                 [ #  # ]
     882                 :          0 :                 bChangedOtherwise = true;
     883                 :            :             }
     884                 :            :         }
     885                 :          0 :         break;
     886                 :            : 
     887                 :            :         case SCHATTR_TEXT_DEGREES:
     888                 :            :         {
     889                 :            :             // convert int to double (divided by 100)
     890                 :            :             double fVal = static_cast< double >(
     891                 :            :                 static_cast< const SfxInt32Item & >(
     892         [ #  # ]:          0 :                     rItemSet.Get( nWhichId )).GetValue()) / 100.0;
     893                 :          0 :             double fOldVal = 0.0;
     894                 :            :             bool bPropExisted =
     895 [ #  # ][ #  # ]:          0 :                 ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldVal );
         [ #  # ][ #  # ]
     896                 :            : 
     897 [ #  # ][ #  # ]:          0 :             if( ! bPropExisted ||
                 [ #  # ]
     898                 :            :                 ( bPropExisted && fOldVal != fVal ))
     899                 :            :             {
     900 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fVal ));
         [ #  # ][ #  # ]
                 [ #  # ]
     901                 :          0 :                 bChangedOtherwise = true;
     902                 :            :             }
     903                 :            :         }
     904                 :          0 :         break;
     905                 :            : 
     906                 :            :         case SID_ATTR_NUMBERFORMAT_VALUE:
     907                 :            :         {
     908         [ #  # ]:          0 :             if( m_pExplicitScale )
     909                 :            :             {
     910                 :            :                 bool bUseSourceFormat =
     911                 :            :                     (static_cast< const SfxBoolItem & >(
     912         [ #  # ]:          0 :                         rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue() );
     913                 :            : 
     914         [ #  # ]:          0 :                 if( ! bUseSourceFormat )
     915                 :            :                 {
     916                 :            :                     sal_Int32 nFmt = static_cast< sal_Int32 >(
     917                 :            :                         static_cast< const SfxUInt32Item & >(
     918         [ #  # ]:          0 :                             rItemSet.Get( nWhichId )).GetValue());
     919                 :            : 
     920         [ #  # ]:          0 :                     aValue = uno::makeAny(nFmt);
     921 [ #  # ][ #  # ]:          0 :                     if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
         [ #  # ][ #  # ]
                 [ #  # ]
     922                 :            :                     {
     923 [ #  # ][ #  # ]:          0 :                         GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
         [ #  # ][ #  # ]
     924                 :          0 :                         bChangedOtherwise = true;
     925                 :            :                     }
     926                 :            :                 }
     927                 :            :             }
     928                 :            :         }
     929                 :          0 :         break;
     930                 :            : 
     931                 :            :         case SID_ATTR_NUMBERFORMAT_SOURCE:
     932                 :            :         {
     933                 :            :             bool bUseSourceFormat =
     934                 :            :                 (static_cast< const SfxBoolItem & >(
     935         [ #  # ]:          0 :                     rItemSet.Get( nWhichId )).GetValue() );
     936 [ #  # ][ #  # ]:          0 :             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
         [ #  # ][ #  # ]
     937                 :            : 
     938                 :          0 :             bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
     939         [ #  # ]:          0 :             if( bChangedOtherwise )
     940                 :            :             {
     941         [ #  # ]:          0 :                 if( ! bUseSourceFormat )
     942                 :            :                 {
     943         [ #  # ]:          0 :                     SfxItemState aState = rItemSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE );
     944         [ #  # ]:          0 :                     if( aState == SFX_ITEM_SET )
     945                 :            :                     {
     946                 :            :                         sal_Int32 nFormatKey = static_cast< sal_Int32 >(
     947                 :            :                         static_cast< const SfxUInt32Item & >(
     948         [ #  # ]:          0 :                             rItemSet.Get( SID_ATTR_NUMBERFORMAT_VALUE )).GetValue());
     949         [ #  # ]:          0 :                         aValue <<= nFormatKey;
     950                 :            :                     }
     951                 :            :                     else
     952                 :            :                     {
     953                 :            :                         Reference< chart2::XCoordinateSystem > xCooSys(
     954                 :            :                         AxisHelper::getCoordinateSystemOfAxis(
     955 [ #  # ][ #  # ]:          0 :                               m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
     956                 :            : 
     957                 :            :                         sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
     958 [ #  # ][ #  # ]:          0 :                             m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
     959                 :            : 
     960         [ #  # ]:          0 :                         aValue <<= nFormatKey;
     961                 :            :                     }
     962                 :            :                 }
     963                 :            :                 // else set a void Any
     964 [ #  # ][ #  # ]:          0 :                 GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
         [ #  # ][ #  # ]
     965                 :            :             }
     966                 :            :         }
     967                 :          0 :         break;
     968                 :            : 
     969                 :            :         case SCHATTR_AXISTYPE:
     970                 :            :         {
     971         [ #  # ]:          0 :             sal_Int32 nNewAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();//::com::sun::star::chart2::AxisType
     972                 :          0 :             aScale.AxisType = nNewAxisType;
     973                 :          0 :             bSetScale = true;
     974                 :            :         }
     975                 :          0 :         break;
     976                 :            : 
     977                 :            :         case SCHATTR_AXIS_AUTO_DATEAXIS:
     978                 :            :         {
     979         [ #  # ]:          0 :             bool bNewValue = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
     980                 :          0 :             bool bOldValue = aScale.AutoDateAxis;
     981         [ #  # ]:          0 :             if( bOldValue != bNewValue )
     982                 :            :             {
     983                 :          0 :                 aScale.AutoDateAxis = bNewValue;
     984                 :          0 :                 bSetScale = true;
     985                 :            :             }
     986                 :            :         }
     987                 :          0 :         break;
     988                 :            :     }
     989                 :            : 
     990         [ #  # ]:          0 :     if( bSetScale )
     991 [ #  # ][ #  # ]:          0 :         m_xAxis->setScaleData( aScale );
     992                 :            : 
     993 [ #  # ][ #  # ]:          0 :     return (bSetScale || bChangedOtherwise);
                 [ #  # ]
     994                 :            : }
     995                 :            : 
     996                 :            : } //  namespace wrapper
     997                 :            : } //  namespace chart
     998                 :            : 
     999                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10