LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedAxisAndGridExistenceProperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 141 171 82.5 %
Date: 2012-08-25 Functions: 17 21 81.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 154 317 48.6 %

           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                 :            : 
      21                 :            : #include "WrappedAxisAndGridExistenceProperties.hxx"
      22                 :            : #include "AxisHelper.hxx"
      23                 :            : #include "ChartModelHelper.hxx"
      24                 :            : #include "TitleHelper.hxx"
      25                 :            : #include "macros.hxx"
      26                 :            : 
      27                 :            : using namespace ::com::sun::star;
      28                 :            : using ::com::sun::star::uno::Any;
      29                 :            : using ::com::sun::star::uno::Reference;
      30                 :            : using ::com::sun::star::uno::Sequence;
      31                 :            : using ::rtl::OUString;
      32                 :            : 
      33                 :            : //.............................................................................
      34                 :            : namespace chart
      35                 :            : {
      36                 :            : namespace wrapper
      37                 :            : {
      38                 :            : 
      39                 :            : class WrappedAxisAndGridExistenceProperty : public WrappedProperty
      40                 :            : {
      41                 :            : public:
      42                 :            :     WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
      43                 :            :         , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
      44                 :            :     virtual ~WrappedAxisAndGridExistenceProperty();
      45                 :            : 
      46                 :            :     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
      47                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      48                 :            : 
      49                 :            :     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
      50                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      51                 :            : 
      52                 :            :     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
      53                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      54                 :            : 
      55                 :            : private: //member
      56                 :            :     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
      57                 :            :     bool        m_bAxis;
      58                 :            :     bool        m_bMain;
      59                 :            :     sal_Int32   m_nDimensionIndex;
      60                 :            : };
      61                 :            : 
      62                 :         33 : void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
      63                 :            :             , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      64                 :            : {
      65 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 0, spChart2ModelContact ) );//x axis
                 [ +  - ]
      66 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 0, spChart2ModelContact ) );//x secondary axis
                 [ +  - ]
      67 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 0, spChart2ModelContact ) );//x grid
                 [ +  - ]
      68 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 0, spChart2ModelContact ) );//x help grid
                 [ +  - ]
      69                 :            : 
      70 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 1, spChart2ModelContact ) );//y axis
                 [ +  - ]
      71 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 1, spChart2ModelContact ) );//y secondary axis
                 [ +  - ]
      72 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 1, spChart2ModelContact ) );//y grid
                 [ +  - ]
      73 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 1, spChart2ModelContact ) );//y help grid
                 [ +  - ]
      74                 :            : 
      75 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 2, spChart2ModelContact ) );//z axis
                 [ +  - ]
      76 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 2, spChart2ModelContact ) );//z grid
                 [ +  - ]
      77 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 2, spChart2ModelContact ) );//z help grid
                 [ +  - ]
      78                 :         33 : }
      79                 :            : 
      80                 :        363 : WrappedAxisAndGridExistenceProperty::WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
      81                 :            :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      82                 :            :             : WrappedProperty(OUString(),OUString())
      83                 :            :             , m_spChart2ModelContact( spChart2ModelContact )
      84                 :            :             , m_bAxis( bAxis )
      85                 :            :             , m_bMain( bMain )
      86 [ +  - ][ +  - ]:        363 :             , m_nDimensionIndex( nDimensionIndex )
      87                 :            : {
      88      [ +  +  + ]:        363 :     switch( m_nDimensionIndex )
      89                 :            :     {
      90                 :            :         case 0:
      91                 :            :         {
      92         [ +  + ]:        132 :             if( m_bAxis )
      93                 :            :             {
      94         [ +  + ]:         66 :                 if( m_bMain )
      95                 :         33 :                     m_aOuterName = "HasXAxis";
      96                 :            :                 else
      97                 :         33 :                     m_aOuterName = "HasSecondaryXAxis";
      98                 :            :             }
      99                 :            :             else
     100                 :            :             {
     101         [ +  + ]:         66 :                 if( m_bMain )
     102                 :         33 :                     m_aOuterName = "HasXAxisGrid";
     103                 :            :                 else
     104                 :         33 :                     m_aOuterName = "HasXAxisHelpGrid";
     105                 :            :             }
     106                 :            :         }
     107                 :        132 :         break;
     108                 :            :         case 2:
     109                 :            :         {
     110         [ +  + ]:         99 :             if( m_bAxis )
     111                 :            :             {
     112                 :            :                 OSL_ENSURE(m_bMain == true,"there is no secondary z axis at the old api");
     113                 :         33 :                 m_bMain = true;
     114                 :         33 :                 m_aOuterName = "HasZAxis";
     115                 :            :             }
     116                 :            :             else
     117                 :            :             {
     118         [ +  + ]:         66 :                 if( m_bMain )
     119                 :         33 :                     m_aOuterName = "HasZAxisGrid";
     120                 :            :                 else
     121                 :         33 :                     m_aOuterName = "HasZAxisHelpGrid";
     122                 :            :             }
     123                 :            :         }
     124                 :         99 :         break;
     125                 :            :         default:
     126                 :            :         {
     127         [ +  + ]:        132 :             if( m_bAxis )
     128                 :            :             {
     129         [ +  + ]:         66 :                 if( m_bMain )
     130                 :         33 :                     m_aOuterName = "HasYAxis";
     131                 :            :                 else
     132                 :         33 :                     m_aOuterName = "HasSecondaryYAxis";
     133                 :            :             }
     134                 :            :             else
     135                 :            :             {
     136         [ +  + ]:         66 :                 if( m_bMain )
     137                 :         33 :                     m_aOuterName = "HasYAxisGrid";
     138                 :            :                 else
     139                 :         33 :                     m_aOuterName = "HasYAxisHelpGrid";
     140                 :            :             }
     141                 :            :         }
     142                 :        132 :         break;
     143                 :            :     }
     144                 :        363 : }
     145                 :            : 
     146         [ +  - ]:        363 : WrappedAxisAndGridExistenceProperty::~WrappedAxisAndGridExistenceProperty()
     147                 :            : {
     148         [ -  + ]:        726 : }
     149                 :            : 
     150                 :         70 : void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     151                 :            :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     152                 :            : {
     153                 :         70 :     sal_Bool bNewValue = false;
     154         [ -  + ]:         70 :     if( ! (rOuterValue >>= bNewValue) )
     155 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException( "Has axis or grid properties require boolean values", 0, 0 );
     156                 :            : 
     157                 :         70 :     sal_Bool bOldValue = sal_False;
     158         [ +  - ]:         70 :     getPropertyValue( xInnerPropertySet ) >>= bOldValue;
     159                 :            : 
     160         [ +  + ]:         70 :     if( bOldValue == bNewValue )
     161                 :         70 :         return;
     162                 :            : 
     163         [ +  - ]:         46 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     164         [ +  + ]:         46 :     if( bNewValue )
     165                 :            :     {
     166         [ +  + ]:         28 :         if( m_bAxis )
     167         [ +  - ]:         16 :             AxisHelper::showAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
     168                 :            :         else
     169         [ +  - ]:         12 :             AxisHelper::showGrid( m_nDimensionIndex, 0, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
     170                 :            :     }
     171                 :            :     else
     172                 :            :     {
     173         [ +  + ]:         18 :         if( m_bAxis )
     174         [ +  - ]:         12 :             AxisHelper::hideAxis( m_nDimensionIndex, m_bMain, xDiagram );
     175                 :            :         else
     176         [ +  - ]:          6 :             AxisHelper::hideGrid( m_nDimensionIndex, 0, m_bMain, xDiagram );
     177                 :         70 :     }
     178                 :            : }
     179                 :            : 
     180                 :        276 : Any WrappedAxisAndGridExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
     181                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     182                 :            : {
     183                 :        276 :     Any aRet;
     184         [ +  - ]:        276 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     185         [ +  + ]:        276 :     if(m_bAxis)
     186                 :            :     {
     187         [ +  - ]:        144 :         sal_Bool bShown = AxisHelper::isAxisShown( m_nDimensionIndex, m_bMain, xDiagram );
     188         [ +  - ]:        144 :         aRet <<= bShown;
     189                 :            :     }
     190                 :            :     else
     191                 :            :     {
     192         [ +  - ]:        132 :         sal_Bool bShown = AxisHelper::isGridShown( m_nDimensionIndex, 0, m_bMain, xDiagram );
     193         [ +  - ]:        132 :         aRet <<= bShown;
     194                 :            :     }
     195                 :        276 :     return aRet;
     196                 :            : }
     197                 :            : 
     198                 :          0 : Any WrappedAxisAndGridExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     199                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     200                 :            : {
     201                 :          0 :     Any aRet;
     202         [ #  # ]:          0 :     aRet <<= false;
     203                 :          0 :     return aRet;
     204                 :            : }
     205                 :            : 
     206                 :            : //---------------------------------------------------------------------------------------------------------------
     207                 :            : 
     208                 :            : class WrappedAxisTitleExistenceProperty : public WrappedProperty
     209                 :            : {
     210                 :            : public:
     211                 :            :     WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
     212                 :            :         , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
     213                 :            :     virtual ~WrappedAxisTitleExistenceProperty();
     214                 :            : 
     215                 :            :     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
     216                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     217                 :            : 
     218                 :            :     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
     219                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     220                 :            : 
     221                 :            :     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
     222                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     223                 :            : 
     224                 :            : private: //member
     225                 :            :     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
     226                 :            :     TitleHelper::eTitleType             m_eTitleType;
     227                 :            : };
     228                 :            : 
     229                 :         33 : void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
     230                 :            :             , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     231                 :            : {
     232 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisTitleExistenceProperty( 0, spChart2ModelContact ) );//x axis title
                 [ +  - ]
     233 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisTitleExistenceProperty( 1, spChart2ModelContact ) );//y axis title
                 [ +  - ]
     234 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisTitleExistenceProperty( 2, spChart2ModelContact ) );//z axis title
                 [ +  - ]
     235 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisTitleExistenceProperty( 3, spChart2ModelContact ) );//secondary x axis title
                 [ +  - ]
     236 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisTitleExistenceProperty( 4, spChart2ModelContact ) );//secondary y axis title
                 [ +  - ]
     237                 :         33 : }
     238                 :            : 
     239                 :        165 : WrappedAxisTitleExistenceProperty::WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
     240                 :            :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     241                 :            :             : WrappedProperty(OUString(),OUString())
     242                 :            :             , m_spChart2ModelContact( spChart2ModelContact )
     243 [ +  - ][ +  - ]:        165 :             , m_eTitleType( TitleHelper::Y_AXIS_TITLE )
     244                 :            : {
     245   [ +  +  +  +  :        165 :     switch( nTitleIndex )
                      + ]
     246                 :            :     {
     247                 :            :         case 0:
     248                 :         33 :             m_aOuterName = "HasXAxisTitle";
     249                 :         33 :             m_eTitleType = TitleHelper::X_AXIS_TITLE;
     250                 :         33 :             break;
     251                 :            :         case 2:
     252                 :         33 :             m_aOuterName = "HasZAxisTitle";
     253                 :         33 :             m_eTitleType = TitleHelper::Z_AXIS_TITLE;
     254                 :         33 :             break;
     255                 :            :         case 3:
     256                 :         33 :             m_aOuterName = "HasSecondaryXAxisTitle";
     257                 :         33 :             m_eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
     258                 :         33 :             break;
     259                 :            :         case 4:
     260                 :         33 :             m_aOuterName = "HasSecondaryYAxisTitle";
     261                 :         33 :             m_eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
     262                 :         33 :             break;
     263                 :            :         default:
     264                 :         33 :             m_aOuterName = "HasYAxisTitle";
     265                 :         33 :             m_eTitleType = TitleHelper::Y_AXIS_TITLE;
     266                 :         33 :             break;
     267                 :            :     }
     268                 :        165 : }
     269                 :            : 
     270         [ +  - ]:        165 : WrappedAxisTitleExistenceProperty::~WrappedAxisTitleExistenceProperty()
     271                 :            : {
     272         [ -  + ]:        330 : }
     273                 :            : 
     274                 :          0 : void WrappedAxisTitleExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     275                 :            :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     276                 :            : {
     277                 :          0 :     sal_Bool bNewValue = false;
     278         [ #  # ]:          0 :     if( ! (rOuterValue >>= bNewValue) )
     279 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException( "Has axis or grid properties require boolean values", 0, 0 );
     280                 :            : 
     281                 :          0 :     sal_Bool bOldValue = sal_False;
     282         [ #  # ]:          0 :     getPropertyValue( xInnerPropertySet ) >>= bOldValue;
     283                 :            : 
     284         [ #  # ]:          0 :     if( bOldValue == bNewValue )
     285                 :          0 :         return;
     286                 :            : 
     287         [ #  # ]:          0 :     if( bNewValue )
     288                 :            :     {
     289                 :          0 :         rtl::OUString aTitleText;
     290                 :            :         TitleHelper::createTitle(  m_eTitleType, aTitleText
     291 [ #  # ][ #  # ]:          0 :             , m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
     292                 :            :     }
     293                 :            :     else
     294                 :            :     {
     295 [ #  # ][ #  # ]:          0 :         TitleHelper::removeTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
     296                 :            :     }
     297                 :            : }
     298                 :            : 
     299                 :         90 : Any WrappedAxisTitleExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
     300                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     301                 :            : {
     302                 :         90 :     sal_Bool bHasTitle = sal_False;
     303                 :            : 
     304 [ +  - ][ +  - ]:         90 :     Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) );
     305 [ #  # ][ #  # ]:         90 :     if( xTitle.is() && !TitleHelper::getCompleteString( xTitle ).isEmpty() )
                 [ -  + ]
           [ -  +  #  # ]
                 [ -  + ]
     306                 :          0 :         bHasTitle = sal_True;
     307                 :            : 
     308                 :         90 :     Any aRet;
     309         [ +  - ]:         90 :     aRet <<= bHasTitle;
     310                 :         90 :     return aRet;
     311                 :            : 
     312                 :            : }
     313                 :            : 
     314                 :          0 : Any WrappedAxisTitleExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     315                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     316                 :            : {
     317                 :          0 :     Any aRet;
     318         [ #  # ]:          0 :     aRet <<= sal_Bool( sal_False );
     319                 :          0 :     return aRet;
     320                 :            : }
     321                 :            : 
     322                 :            : //---------------------------------------------------------------------------------------------------------------
     323                 :            : 
     324                 :            : class WrappedAxisLabelExistenceProperty : public WrappedProperty
     325                 :            : {
     326                 :            : public:
     327                 :            :     WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
     328                 :            :         , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
     329                 :            :     virtual ~WrappedAxisLabelExistenceProperty();
     330                 :            : 
     331                 :            :     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
     332                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     333                 :            : 
     334                 :            :     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
     335                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     336                 :            : 
     337                 :            :     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
     338                 :            :                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     339                 :            : 
     340                 :            : private: //member
     341                 :            :     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
     342                 :            :     bool        m_bMain;
     343                 :            :     sal_Int32   m_nDimensionIndex;
     344                 :            : };
     345                 :            : 
     346                 :         33 : void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
     347                 :            :             , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     348                 :            : {
     349 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisLabelExistenceProperty( true, 0, spChart2ModelContact ) );//x axis
                 [ +  - ]
     350 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisLabelExistenceProperty( true, 1, spChart2ModelContact ) );//y axis
                 [ +  - ]
     351 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisLabelExistenceProperty( true, 2, spChart2ModelContact ) );//z axis
                 [ +  - ]
     352 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisLabelExistenceProperty( false, 0, spChart2ModelContact ) );//secondary x axis
                 [ +  - ]
     353 [ +  - ][ +  - ]:         33 :     rList.push_back( new WrappedAxisLabelExistenceProperty( false, 1, spChart2ModelContact ) );//secondary y axis
                 [ +  - ]
     354                 :         33 : }
     355                 :            : 
     356                 :        165 : WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
     357                 :            :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     358                 :            :             : WrappedProperty(OUString(),OUString())
     359                 :            :             , m_spChart2ModelContact( spChart2ModelContact )
     360                 :            :             , m_bMain( bMain )
     361 [ +  - ][ +  - ]:        165 :             , m_nDimensionIndex( nDimensionIndex )
     362                 :            : {
     363      [ +  +  + ]:        165 :     switch( m_nDimensionIndex )
     364                 :            :     {
     365                 :            :         case 0:
     366         [ +  + ]:         66 :             m_bMain ? m_aOuterName = "HasXAxisDescription" : m_aOuterName = "HasSecondaryXAxisDescription";
     367                 :         66 :             break;
     368                 :            :         case 2:
     369                 :            :             OSL_ENSURE(m_bMain,"there is no description available for a secondary z axis");
     370                 :         33 :             m_aOuterName = "HasZAxisDescription";
     371                 :         33 :             break;
     372                 :            :         default:
     373         [ +  + ]:         66 :             m_bMain ? m_aOuterName = "HasYAxisDescription" : m_aOuterName = "HasSecondaryYAxisDescription";
     374                 :         66 :             break;
     375                 :            :     }
     376                 :        165 : }
     377                 :            : 
     378         [ +  - ]:        165 : WrappedAxisLabelExistenceProperty::~WrappedAxisLabelExistenceProperty()
     379                 :            : {
     380         [ -  + ]:        330 : }
     381                 :            : 
     382                 :         34 : void WrappedAxisLabelExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     383                 :            :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     384                 :            : {
     385                 :         34 :     sal_Bool bNewValue = false;
     386         [ -  + ]:         34 :     if( ! (rOuterValue >>= bNewValue) )
     387 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException( "Has axis or grid properties require boolean values", 0, 0 );
     388                 :            : 
     389                 :         34 :     sal_Bool bOldValue = sal_False;
     390         [ +  - ]:         34 :     getPropertyValue( xInnerPropertySet ) >>= bOldValue;
     391                 :            : 
     392         [ +  + ]:         34 :     if( bOldValue == bNewValue )
     393                 :         34 :         return;
     394                 :            : 
     395         [ +  - ]:         16 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     396 [ +  - ][ +  - ]:         16 :     Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
     397 [ #  # ][ -  + ]:         16 :     if( !xProp.is() && bNewValue )
                 [ -  + ]
     398                 :            :     {
     399                 :            :         //create axis if needed
     400 [ #  # ][ #  # ]:          0 :         xProp.set( AxisHelper::createAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext ), uno::UNO_QUERY );
     401         [ #  # ]:          0 :         if( xProp.is() )
     402 [ #  # ][ #  # ]:          0 :             xProp->setPropertyValue( "Show", uno::makeAny( sal_False ) );
                 [ #  # ]
     403                 :            :     }
     404         [ +  - ]:         16 :     if( xProp.is() )
     405 [ +  - ][ +  - ]:         34 :         xProp->setPropertyValue( "DisplayLabels", rOuterValue );
     406                 :            : }
     407                 :            : 
     408                 :         42 : Any WrappedAxisLabelExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
     409                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     410                 :            : {
     411                 :         42 :     Any aRet;
     412         [ +  - ]:         42 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     413 [ +  - ][ +  - ]:         42 :     Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
     414         [ +  + ]:         42 :     if( xProp.is() )
     415 [ +  - ][ +  - ]:         24 :         aRet = xProp->getPropertyValue( "DisplayLabels" );
     416                 :            :     else
     417         [ +  - ]:         18 :         aRet <<= sal_False;
     418                 :         42 :     return aRet;
     419                 :            : }
     420                 :            : 
     421                 :          0 : Any WrappedAxisLabelExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     422                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     423                 :            : {
     424                 :          0 :     Any aRet;
     425         [ #  # ]:          0 :     aRet <<= sal_Bool( sal_True );
     426                 :          0 :     return aRet;
     427                 :            : }
     428                 :            : 
     429                 :            : } //namespace wrapper
     430                 :            : } //namespace chart
     431                 :            : //.............................................................................
     432                 :            : 
     433                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10