LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - LegendWrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 147 177 83.1 %
Date: 2012-08-25 Functions: 29 34 85.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 129 282 45.7 %

           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 "LegendWrapper.hxx"
      21                 :            : #include "macros.hxx"
      22                 :            : #include "Chart2ModelContact.hxx"
      23                 :            : #include "LegendHelper.hxx"
      24                 :            : #include "ContainerHelper.hxx"
      25                 :            : #include <comphelper/InlineContainer.hxx>
      26                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27                 :            : #include <com/sun/star/chart2/XTitled.hpp>
      28                 :            : #include <com/sun/star/chart/ChartLegendPosition.hpp>
      29                 :            : #include <com/sun/star/chart2/LegendPosition.hpp>
      30                 :            : #include <com/sun/star/chart/ChartLegendExpansion.hpp>
      31                 :            : #include <com/sun/star/chart2/RelativePosition.hpp>
      32                 :            : #include <com/sun/star/drawing/FillStyle.hpp>
      33                 :            : 
      34                 :            : #include "CharacterProperties.hxx"
      35                 :            : #include "LineProperties.hxx"
      36                 :            : #include "FillProperties.hxx"
      37                 :            : #include "UserDefinedProperties.hxx"
      38                 :            : #include "WrappedCharacterHeightProperty.hxx"
      39                 :            : #include "PositionAndSizeHelper.hxx"
      40                 :            : #include "WrappedDirectStateProperty.hxx"
      41                 :            : #include "WrappedAutomaticPositionProperties.hxx"
      42                 :            : #include "WrappedScaleTextProperties.hxx"
      43                 :            : 
      44                 :            : #include <algorithm>
      45                 :            : #include <rtl/ustrbuf.hxx>
      46                 :            : 
      47                 :            : using namespace ::com::sun::star;
      48                 :            : using ::com::sun::star::beans::Property;
      49                 :            : using ::osl::MutexGuard;
      50                 :            : using ::com::sun::star::uno::Any;
      51                 :            : using ::com::sun::star::uno::Reference;
      52                 :            : using ::com::sun::star::uno::Sequence;
      53                 :            : 
      54                 :            : //-----------------------------------------------------------------------------
      55                 :            : 
      56                 :            : namespace chart
      57                 :            : {
      58                 :            : class WrappedLegendAlignmentProperty : public WrappedProperty
      59                 :            : {
      60                 :            : public:
      61                 :            :     WrappedLegendAlignmentProperty();
      62                 :            :     virtual ~WrappedLegendAlignmentProperty();
      63                 :            : 
      64                 :            :     virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      65                 :            :                                     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
      66                 :            :     virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      67                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
      68                 :            : 
      69                 :            : protected:
      70                 :            :     virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
      71                 :            :     virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
      72                 :            : };
      73                 :            : 
      74                 :         13 : WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty()
      75         [ +  - ]:         13 :     : ::chart::WrappedProperty( "Alignment", "AnchorPosition" )
      76                 :            : {
      77                 :         13 : }
      78                 :         13 : WrappedLegendAlignmentProperty::~WrappedLegendAlignmentProperty()
      79                 :            : {
      80         [ -  + ]:         26 : }
      81                 :            : 
      82                 :         13 : Any WrappedLegendAlignmentProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      83                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      84                 :            : {
      85                 :         13 :     Any aRet;
      86         [ +  - ]:         13 :     if( xInnerPropertySet.is() )
      87                 :            :     {
      88                 :         13 :         sal_Bool bShowLegend = sal_True;
      89 [ +  - ][ +  - ]:         13 :         xInnerPropertySet->getPropertyValue( "Show" ) >>= bShowLegend;
      90         [ +  + ]:         13 :         if(!bShowLegend)
      91                 :            :         {
      92         [ +  - ]:          2 :             aRet = uno::makeAny( ::com::sun::star::chart::ChartLegendPosition_NONE );
      93                 :            :         }
      94                 :            :         else
      95                 :            :         {
      96 [ +  - ][ +  - ]:         11 :             aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
      97         [ +  - ]:         13 :             aRet = this->convertInnerToOuterValue( aRet );
      98                 :            :         }
      99                 :            :     }
     100                 :         13 :     return aRet;
     101                 :            : }
     102                 :            : 
     103                 :          8 : void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     104                 :            :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     105                 :            : {
     106         [ +  - ]:          8 :     if(xInnerPropertySet.is())
     107                 :            :     {
     108                 :          8 :         sal_Bool bNewShowLegend = sal_True;
     109                 :          8 :         sal_Bool bOldShowLegend = sal_True;
     110                 :            :         {
     111                 :          8 :             ::com::sun::star::chart::ChartLegendPosition eOuterPos(::com::sun::star::chart::ChartLegendPosition_NONE);
     112 [ +  - ][ +  - ]:          8 :             if( (rOuterValue >>= eOuterPos)  && eOuterPos == ::com::sun::star::chart::ChartLegendPosition_NONE )
         [ +  + ][ +  + ]
     113                 :          2 :                 bNewShowLegend = sal_False;
     114 [ +  - ][ +  - ]:          8 :             xInnerPropertySet->getPropertyValue( "Show" ) >>= bOldShowLegend;
     115                 :            :         }
     116         [ +  + ]:          8 :         if(bNewShowLegend!=bOldShowLegend)
     117                 :            :         {
     118 [ +  - ][ +  - ]:          2 :             xInnerPropertySet->setPropertyValue( "Show", uno::makeAny(bNewShowLegend) );
                 [ +  - ]
     119                 :            :         }
     120         [ +  + ]:          8 :         if(!bNewShowLegend)
     121                 :          8 :             return;
     122                 :            : 
     123                 :            :         //set corresponding LegendPosition
     124         [ +  - ]:          6 :         Any aInnerValue = this->convertOuterToInnerValue( rOuterValue );
     125 [ +  - ][ +  - ]:          6 :         xInnerPropertySet->setPropertyValue( m_aInnerName, aInnerValue );
     126                 :            : 
     127                 :            :         //correct LegendExpansion
     128                 :          6 :         chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END);
     129 [ +  - ][ +  - ]:          6 :         if( aInnerValue >>= eNewInnerPos )
     130                 :            :         {
     131                 :            :             ::com::sun::star::chart::ChartLegendExpansion eNewExpansion =
     132                 :            :                 ( eNewInnerPos == chart2::LegendPosition_LINE_END ||
     133                 :            :                   eNewInnerPos == chart2::LegendPosition_LINE_START )
     134                 :            :                 ? ::com::sun::star::chart::ChartLegendExpansion_HIGH
     135 [ -  + ][ #  # ]:          6 :                 : ::com::sun::star::chart::ChartLegendExpansion_WIDE;
     136                 :            : 
     137                 :          6 :             ::com::sun::star::chart::ChartLegendExpansion eOldExpansion( ::com::sun::star::chart::ChartLegendExpansion_HIGH );
     138                 :            :             bool bExpansionWasSet(
     139 [ +  - ][ +  - ]:          6 :                 xInnerPropertySet->getPropertyValue( "Expansion" ) >>= eOldExpansion );
                 [ +  - ]
     140                 :            : 
     141 [ -  + ][ +  - ]:          6 :             if( !bExpansionWasSet || (eOldExpansion != eNewExpansion))
     142 [ #  # ][ #  # ]:          6 :                 xInnerPropertySet->setPropertyValue( "Expansion", uno::makeAny( eNewExpansion ));
                 [ #  # ]
     143                 :            :         }
     144                 :            : 
     145                 :            :         //correct RelativePosition
     146 [ +  - ][ +  - ]:          6 :         Any aRelativePosition( xInnerPropertySet->getPropertyValue("RelativePosition") );
     147         [ -  + ]:          6 :         if(aRelativePosition.hasValue())
     148                 :            :         {
     149 [ #  # ][ #  # ]:          0 :             xInnerPropertySet->setPropertyValue( "RelativePosition", Any() );
     150                 :          8 :         }
     151                 :            :     }
     152                 :            : }
     153                 :            : 
     154                 :         11 : Any WrappedLegendAlignmentProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
     155                 :            : {
     156                 :         11 :     ::com::sun::star::chart::ChartLegendPosition ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
     157                 :            : 
     158                 :            :     chart2::LegendPosition eNewPos;
     159 [ +  - ][ +  - ]:         11 :     if( rInnerValue >>= eNewPos )
     160                 :            :     {
     161   [ -  +  -  -  :         11 :         switch( eNewPos )
                      - ]
     162                 :            :         {
     163                 :            :             case chart2::LegendPosition_LINE_START:
     164                 :          0 :                 ePos = ::com::sun::star::chart::ChartLegendPosition_LEFT;
     165                 :          0 :                 break;
     166                 :            :             case chart2::LegendPosition_LINE_END:
     167                 :         11 :                 ePos = ::com::sun::star::chart::ChartLegendPosition_RIGHT;
     168                 :         11 :                 break;
     169                 :            :             case chart2::LegendPosition_PAGE_START:
     170                 :          0 :                 ePos = ::com::sun::star::chart::ChartLegendPosition_TOP;
     171                 :          0 :                 break;
     172                 :            :             case chart2::LegendPosition_PAGE_END:
     173                 :          0 :                 ePos = ::com::sun::star::chart::ChartLegendPosition_BOTTOM;
     174                 :          0 :                 break;
     175                 :            : 
     176                 :            :             default:
     177                 :          0 :                 ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
     178                 :         11 :                 break;
     179                 :            :         }
     180                 :            :     }
     181         [ +  - ]:         11 :     return uno::makeAny( ePos );
     182                 :            : }
     183                 :          6 : Any WrappedLegendAlignmentProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
     184                 :            : {
     185                 :          6 :     chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END;
     186                 :            : 
     187                 :            :     ::com::sun::star::chart::ChartLegendPosition ePos;
     188 [ +  - ][ +  - ]:          6 :     if( rOuterValue >>= ePos )
     189                 :            :     {
     190   [ -  +  -  -  :          6 :         switch( ePos )
                      - ]
     191                 :            :         {
     192                 :            :             case ::com::sun::star::chart::ChartLegendPosition_LEFT:
     193                 :          0 :                 eNewPos = chart2::LegendPosition_LINE_START;
     194                 :          0 :                 break;
     195                 :            :             case ::com::sun::star::chart::ChartLegendPosition_RIGHT:
     196                 :          6 :                 eNewPos = chart2::LegendPosition_LINE_END;
     197                 :          6 :                 break;
     198                 :            :             case ::com::sun::star::chart::ChartLegendPosition_TOP:
     199                 :          0 :                 eNewPos = chart2::LegendPosition_PAGE_START;
     200                 :          0 :                 break;
     201                 :            :             case ::com::sun::star::chart::ChartLegendPosition_BOTTOM:
     202                 :          0 :                 eNewPos = chart2::LegendPosition_PAGE_END;
     203                 :          0 :                 break;
     204                 :            :             default: // NONE
     205                 :          6 :                 break;
     206                 :            :         }
     207                 :            :     }
     208                 :            : 
     209         [ +  - ]:          6 :     return uno::makeAny( eNewPos );
     210                 :            : }
     211                 :            : }
     212                 :            : //-----------------------------------------------------------------------------
     213                 :            : 
     214                 :            : namespace
     215                 :            : {
     216                 :         16 : static const ::rtl::OUString lcl_aServiceName("com.sun.star.comp.chart.Legend");
     217                 :            : 
     218                 :            : enum
     219                 :            : {
     220                 :            :     PROP_LEGEND_ALIGNMENT,
     221                 :            :     PROP_LEGEND_EXPANSION
     222                 :            : };
     223                 :            : 
     224                 :          7 : void lcl_AddPropertiesToVector(
     225                 :            :     ::std::vector< Property > & rOutProperties )
     226                 :            : {
     227                 :            :     rOutProperties.push_back(
     228                 :            :         Property( "Alignment",
     229                 :            :                   PROP_LEGEND_ALIGNMENT,
     230                 :          7 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)),
     231                 :            :                   //#i111967# no PropertyChangeEvent is fired on change so far
     232         [ +  - ]:          7 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     233                 :            : 
     234                 :            :     rOutProperties.push_back(
     235                 :            :         Property( "Expansion",
     236                 :            :                   PROP_LEGEND_EXPANSION,
     237                 :          7 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendExpansion * >(0)),
     238                 :            :                   //#i111967# no PropertyChangeEvent is fired on change so far
     239         [ +  - ]:          7 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     240                 :          7 : }
     241                 :            : 
     242                 :            : struct StaticLegendWrapperPropertyArray_Initializer
     243                 :            : {
     244                 :          7 :     Sequence< Property >* operator()()
     245                 :            :     {
     246 [ +  - ][ +  - ]:          7 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
         [ +  - ][ #  # ]
     247                 :          7 :         return &aPropSeq;
     248                 :            :     }
     249                 :            : 
     250                 :            : private:
     251                 :          7 :     Sequence< Property > lcl_GetPropertySequence()
     252                 :            :     {
     253         [ +  - ]:          7 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
     254         [ +  - ]:          7 :         lcl_AddPropertiesToVector( aProperties );
     255         [ +  - ]:          7 :         ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
     256         [ +  - ]:          7 :         ::chart::LineProperties::AddPropertiesToVector( aProperties );
     257         [ +  - ]:          7 :         ::chart::FillProperties::AddPropertiesToVector( aProperties );
     258         [ +  - ]:          7 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
     259         [ +  - ]:          7 :         ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
     260         [ +  - ]:          7 :         ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
     261                 :            : 
     262                 :            :         ::std::sort( aProperties.begin(), aProperties.end(),
     263         [ +  - ]:          7 :                      ::chart::PropertyNameLess() );
     264                 :            : 
     265         [ +  - ]:          7 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
     266                 :            :     }
     267                 :            : };
     268                 :            : 
     269                 :            : struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer >
     270                 :            : {
     271                 :            : };
     272                 :            : 
     273                 :            : } // anonymous namespace
     274                 :            : 
     275                 :            : // --------------------------------------------------------------------------------
     276                 :            : 
     277                 :            : namespace chart
     278                 :            : {
     279                 :            : namespace wrapper
     280                 :            : {
     281                 :            : 
     282                 :         15 : LegendWrapper::LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
     283                 :            :         m_spChart2ModelContact( spChart2ModelContact ),
     284 [ +  - ][ +  - ]:         15 :         m_aEventListenerContainer( m_aMutex )
     285                 :            : {
     286                 :         15 : }
     287                 :            : 
     288 [ +  - ][ +  - ]:         15 : LegendWrapper::~LegendWrapper()
     289                 :            : {
     290         [ -  + ]:         30 : }
     291                 :            : 
     292                 :            : // ____ XShape ____
     293                 :          9 : awt::Point SAL_CALL LegendWrapper::getPosition()
     294                 :            :     throw (uno::RuntimeException)
     295                 :            : {
     296                 :          9 :     return m_spChart2ModelContact->GetLegendPosition();
     297                 :            : }
     298                 :            : 
     299                 :          6 : void SAL_CALL LegendWrapper::setPosition( const awt::Point& aPosition )
     300                 :            :     throw (uno::RuntimeException)
     301                 :            : {
     302         [ +  - ]:          6 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
     303         [ +  - ]:          6 :     if( xProp.is() )
     304                 :            :     {
     305         [ +  - ]:          6 :         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
     306                 :            : 
     307                 :          6 :         chart2::RelativePosition aRelativePosition;
     308                 :          6 :         aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
     309                 :          6 :         aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
     310                 :          6 :         aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
     311 [ +  - ][ +  - ]:          6 :         xProp->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
                 [ +  - ]
     312                 :          6 :     }
     313                 :          6 : }
     314                 :            : 
     315                 :          0 : awt::Size SAL_CALL LegendWrapper::getSize()
     316                 :            :     throw (uno::RuntimeException)
     317                 :            : {
     318                 :          0 :     return m_spChart2ModelContact->GetLegendSize();
     319                 :            : }
     320                 :            : 
     321                 :          0 : void SAL_CALL LegendWrapper::setSize( const awt::Size& aSize )
     322                 :            :     throw (beans::PropertyVetoException,
     323                 :            :            uno::RuntimeException)
     324                 :            : {
     325         [ #  # ]:          0 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
     326         [ #  # ]:          0 :     if( xProp.is() )
     327                 :            :     {
     328         [ #  # ]:          0 :         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
     329                 :          0 :         awt::Rectangle aPageRectangle( 0,0,aPageSize.Width,aPageSize.Height);
     330                 :            : 
     331         [ #  # ]:          0 :         awt::Point aPos( this->getPosition() );
     332                 :          0 :         awt::Rectangle aNewPositionAndSize(aPos.X,aPos.Y,aSize.Width,aSize.Height);
     333                 :            : 
     334                 :            :         PositionAndSizeHelper::moveObject( OBJECTTYPE_LEGEND
     335         [ #  # ]:          0 :                 , xProp, aNewPositionAndSize, aPageRectangle );
     336                 :          0 :     }
     337                 :          0 : }
     338                 :            : 
     339                 :            : // ____ XShapeDescriptor (base of XShape) ____
     340                 :          2 : ::rtl::OUString SAL_CALL LegendWrapper::getShapeType()
     341                 :            :     throw (uno::RuntimeException)
     342                 :            : {
     343                 :          2 :     return rtl::OUString( "com.sun.star.chart.ChartLegend" );
     344                 :            : }
     345                 :            : 
     346                 :            : // ____ XComponent ____
     347                 :         17 : void SAL_CALL LegendWrapper::dispose()
     348                 :            :     throw (uno::RuntimeException)
     349                 :            : {
     350         [ +  - ]:         17 :     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
     351 [ +  - ][ +  - ]:         17 :     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
                 [ +  - ]
     352                 :            : 
     353 [ +  - ][ +  - ]:         17 :     MutexGuard aGuard( GetMutex());
     354 [ +  - ][ +  - ]:         17 :     clearWrappedPropertySet();
     355                 :         17 : }
     356                 :            : 
     357                 :          4 : void SAL_CALL LegendWrapper::addEventListener(
     358                 :            :     const Reference< lang::XEventListener >& xListener )
     359                 :            :     throw (uno::RuntimeException)
     360                 :            : {
     361                 :          4 :     m_aEventListenerContainer.addInterface( xListener );
     362                 :          4 : }
     363                 :            : 
     364                 :          2 : void SAL_CALL LegendWrapper::removeEventListener(
     365                 :            :     const Reference< lang::XEventListener >& aListener )
     366                 :            :     throw (uno::RuntimeException)
     367                 :            : {
     368                 :          2 :     m_aEventListenerContainer.removeInterface( aListener );
     369                 :          2 : }
     370                 :            : 
     371                 :            : // ================================================================================
     372                 :            : 
     373                 :            : //ReferenceSizePropertyProvider
     374                 :         20 : void LegendWrapper::updateReferenceSize()
     375                 :            : {
     376 [ +  - ][ +  - ]:         20 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
     377         [ +  - ]:         20 :     if( xProp.is() )
     378                 :            :     {
     379 [ +  - ][ +  - ]:         20 :         if( xProp->getPropertyValue( "ReferencePageSize" ).hasValue() )
                 [ -  + ]
     380         [ #  # ]:          0 :             xProp->setPropertyValue( "ReferencePageSize", uno::makeAny(
     381 [ #  # ][ #  # ]:          0 :                 m_spChart2ModelContact->GetPageSize() ));
                 [ #  # ]
     382                 :         20 :     }
     383                 :         20 : }
     384                 :         58 : Any LegendWrapper::getReferenceSize()
     385                 :            : {
     386                 :         58 :     Any aRet;
     387 [ +  - ][ +  - ]:         58 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
     388         [ +  - ]:         58 :     if( xProp.is() )
     389 [ +  - ][ +  - ]:         58 :         aRet = xProp->getPropertyValue( "ReferencePageSize" );
     390                 :            : 
     391                 :         58 :     return aRet;
     392                 :            : }
     393                 :          0 : awt::Size LegendWrapper::getCurrentSizeForReference()
     394                 :            : {
     395                 :          0 :     return m_spChart2ModelContact->GetPageSize();
     396                 :            : }
     397                 :            : 
     398                 :            : // ================================================================================
     399                 :            : 
     400                 :            : // WrappedPropertySet
     401                 :       1986 : Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
     402                 :            : {
     403                 :       1986 :     Reference< beans::XPropertySet > xRet;
     404         [ +  - ]:       1986 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     405         [ +  - ]:       1986 :     if( xDiagram.is() )
     406 [ +  - ][ +  - ]:       1986 :         xRet.set( xDiagram->getLegend(), uno::UNO_QUERY );
                 [ +  - ]
     407                 :            :     OSL_ENSURE(xRet.is(),"LegendWrapper::getInnerPropertySet() is NULL");
     408                 :       1986 :     return xRet;
     409                 :            : }
     410                 :            : 
     411                 :         13 : const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
     412                 :            : {
     413                 :         13 :     return *StaticLegendWrapperPropertyArray::get();
     414                 :            : }
     415                 :            : 
     416                 :         13 : const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties()
     417                 :            : {
     418                 :         13 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     419                 :            : 
     420 [ +  - ][ +  - ]:         13 :     aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() );
                 [ +  - ]
     421 [ +  - ][ +  - ]:         13 :     aWrappedProperties.push_back( new WrappedProperty( "Expansion", "Expansion"));
                 [ +  - ]
     422         [ +  - ]:         13 :     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     423                 :            :     //same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly
     424 [ +  - ][ +  - ]:         13 :     aWrappedProperties.push_back( new WrappedDirectStateProperty("FillStyle", "FillStyle"));
                 [ +  - ]
     425 [ +  - ][ +  - ]:         13 :     aWrappedProperties.push_back( new WrappedDirectStateProperty("FillColor", "FillColor"));
                 [ +  - ]
     426         [ +  - ]:         13 :     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
     427 [ +  - ][ +  - ]:         13 :     WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
                 [ +  - ]
     428                 :            : 
     429                 :         13 :     return aWrappedProperties;
     430                 :            : }
     431                 :            : 
     432                 :            : // ================================================================================
     433                 :            : 
     434                 :         12 : Sequence< ::rtl::OUString > LegendWrapper::getSupportedServiceNames_Static()
     435                 :            : {
     436                 :         12 :     Sequence< ::rtl::OUString > aServices( 4 );
     437         [ +  - ]:         12 :     aServices[ 0 ] = "com.sun.star.chart.ChartLegend";
     438         [ +  - ]:         12 :     aServices[ 1 ] = "com.sun.star.drawing.Shape";
     439         [ +  - ]:         12 :     aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributeSupplier";
     440         [ +  - ]:         12 :     aServices[ 3 ] = "com.sun.star.style.CharacterProperties";
     441                 :            : 
     442                 :         12 :     return aServices;
     443                 :            : }
     444                 :            : 
     445                 :            : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     446 [ +  - ][ +  - ]:         46 : APPHELPER_XSERVICEINFO_IMPL( LegendWrapper, lcl_aServiceName );
         [ +  + ][ +  + ]
                 [ +  - ]
     447                 :            : 
     448                 :            : } //  namespace wrapper
     449 [ +  - ][ +  - ]:         48 : } //  namespace chart
     450                 :            : 
     451                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10