LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - TitleWrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 187 228 82.0 %
Date: 2012-08-25 Functions: 39 47 83.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 172 384 44.8 %

           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 "TitleWrapper.hxx"
      21                 :            : #include "macros.hxx"
      22                 :            : #include "ContainerHelper.hxx"
      23                 :            : #include "ControllerLockGuard.hxx"
      24                 :            : 
      25                 :            : #include <comphelper/InlineContainer.hxx>
      26                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27                 :            : #include <com/sun/star/chart2/RelativePosition.hpp>
      28                 :            : 
      29                 :            : #include "CharacterProperties.hxx"
      30                 :            : #include "LineProperties.hxx"
      31                 :            : #include "FillProperties.hxx"
      32                 :            : #include "UserDefinedProperties.hxx"
      33                 :            : #include "WrappedCharacterHeightProperty.hxx"
      34                 :            : #include "WrappedTextRotationProperty.hxx"
      35                 :            : #include "WrappedAutomaticPositionProperties.hxx"
      36                 :            : #include "WrappedScaleTextProperties.hxx"
      37                 :            : 
      38                 :            : #include <algorithm>
      39                 :            : #include <rtl/ustrbuf.hxx>
      40                 :            : 
      41                 :            : using namespace ::com::sun::star;
      42                 :            : using ::com::sun::star::beans::Property;
      43                 :            : using ::osl::MutexGuard;
      44                 :            : using ::rtl::OUString;
      45                 :            : using ::com::sun::star::uno::Any;
      46                 :            : using ::com::sun::star::uno::Reference;
      47                 :            : using ::com::sun::star::uno::Sequence;
      48                 :            : 
      49                 :            : 
      50                 :            : namespace chart
      51                 :            : {
      52                 :            : class WrappedTitleStringProperty : public WrappedProperty
      53                 :            : {
      54                 :            : public:
      55                 :            :     WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext );
      56                 :            :     virtual ~WrappedTitleStringProperty();
      57                 :            : 
      58                 :            :     virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      59                 :            :                                     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
      60                 :            :     virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      61                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
      62                 :            :     virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
      63                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
      64                 :            : 
      65                 :            : protected:
      66                 :            :     Reference< uno::XComponentContext > m_xContext;
      67                 :            : };
      68                 :            : 
      69                 :         14 : WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext )
      70                 :            :     : ::chart::WrappedProperty( "String", OUString() )
      71         [ +  - ]:         14 :     , m_xContext( xContext )
      72                 :            : {
      73                 :         14 : }
      74                 :         14 : WrappedTitleStringProperty::~WrappedTitleStringProperty()
      75                 :            : {
      76         [ -  + ]:         28 : }
      77                 :            : 
      78                 :         14 : void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      79                 :            :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
      80                 :            : {
      81         [ +  - ]:         14 :     Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
      82         [ +  - ]:         14 :     if(xTitle.is())
      83                 :            :     {
      84                 :         14 :         OUString aString;
      85                 :         14 :         rOuterValue >>= aString;
      86         [ +  - ]:         14 :         TitleHelper::setCompleteString( aString, xTitle, m_xContext );
      87                 :         14 :     }
      88                 :         14 : }
      89                 :          4 : Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      90                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      91                 :            : {
      92 [ +  - ][ +  - ]:          4 :     Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
      93         [ +  - ]:          4 :     Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
      94         [ +  - ]:          4 :     if(xTitle.is())
      95                 :            :     {
      96 [ +  - ][ +  - ]:          4 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
      97                 :            : 
      98                 :          4 :         ::rtl::OUStringBuffer aBuf;
      99         [ +  + ]:          8 :         for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
     100                 :            :         {
     101 [ +  - ][ +  - ]:          4 :             aBuf.append( aStrings[ i ]->getString());
         [ +  - ][ +  - ]
     102                 :            :         }
     103 [ +  - ][ +  - ]:          4 :         aRet <<= aBuf.makeStringAndClear();
                 [ +  - ]
     104                 :            :     }
     105                 :          4 :     return aRet;
     106                 :            : }
     107                 :          4 : Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     108                 :            :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     109                 :            : {
     110         [ +  - ]:          4 :     return uno::makeAny( rtl::OUString() );//default title is a empty String
     111                 :            : }
     112                 :            : 
     113                 :            : //-----------------------------------------------------------------------------
     114                 :            : 
     115                 :            : class WrappedStackedTextProperty : public WrappedProperty
     116                 :            : {
     117                 :            : public:
     118                 :            :     WrappedStackedTextProperty();
     119                 :            :     virtual ~WrappedStackedTextProperty();
     120                 :            : };
     121                 :            : 
     122                 :         14 : WrappedStackedTextProperty::WrappedStackedTextProperty()
     123         [ +  - ]:         14 :     : ::chart::WrappedProperty( "StackedText", "StackCharacters" )
     124                 :            : {
     125                 :         14 : }
     126                 :         14 : WrappedStackedTextProperty::~WrappedStackedTextProperty()
     127                 :            : {
     128         [ -  + ]:         28 : }
     129                 :            : 
     130                 :            : }// end namespace chart
     131                 :            : 
     132                 :            : //-----------------------------------------------------------------------------
     133                 :            : 
     134                 :            : namespace
     135                 :            : {
     136                 :         16 : static const OUString lcl_aServiceName("com.sun.star.comp.chart.Title");
     137                 :            : 
     138                 :            : enum
     139                 :            : {
     140                 :            :     PROP_TITLE_STRING,
     141                 :            :     PROP_TITLE_TEXT_ROTATION,
     142                 :            :     PROP_TITLE_TEXT_STACKED
     143                 :            : };
     144                 :            : 
     145                 :          2 : void lcl_AddPropertiesToVector(
     146                 :            :     ::std::vector< Property > & rOutProperties )
     147                 :            : {
     148                 :            :     rOutProperties.push_back(
     149                 :            :         Property( "String",
     150                 :            :                   PROP_TITLE_STRING,
     151         [ +  - ]:          2 :                   ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
     152                 :            :                   beans::PropertyAttribute::BOUND
     153         [ +  - ]:          2 :                   | beans::PropertyAttribute::MAYBEVOID ));
     154                 :            : 
     155                 :            :     rOutProperties.push_back(
     156                 :            :         Property( "TextRotation",
     157                 :            :                   PROP_TITLE_TEXT_ROTATION,
     158         [ +  - ]:          2 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     159                 :            :                   beans::PropertyAttribute::BOUND
     160         [ +  - ]:          2 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     161                 :            :     rOutProperties.push_back(
     162                 :            :         Property( "StackedText",
     163                 :            :                   PROP_TITLE_TEXT_STACKED,
     164         [ +  - ]:          2 :                   ::getBooleanCppuType(),
     165                 :            :                   beans::PropertyAttribute::BOUND
     166         [ +  - ]:          2 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     167                 :          2 : }
     168                 :            : 
     169                 :            : struct StaticTitleWrapperPropertyArray_Initializer
     170                 :            : {
     171                 :          2 :     Sequence< Property >* operator()()
     172                 :            :     {
     173 [ +  - ][ +  - ]:          2 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
         [ +  - ][ #  # ]
     174                 :          2 :         return &aPropSeq;
     175                 :            :     }
     176                 :            : 
     177                 :            : private:
     178                 :          2 :     Sequence< Property > lcl_GetPropertySequence()
     179                 :            :     {
     180         [ +  - ]:          2 :         ::std::vector< beans::Property > aProperties;
     181         [ +  - ]:          2 :         lcl_AddPropertiesToVector( aProperties );
     182         [ +  - ]:          2 :         ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
     183         [ +  - ]:          2 :         ::chart::LineProperties::AddPropertiesToVector( aProperties );
     184         [ +  - ]:          2 :         ::chart::FillProperties::AddPropertiesToVector( aProperties );
     185         [ +  - ]:          2 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
     186         [ +  - ]:          2 :         ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
     187         [ +  - ]:          2 :         ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
     188                 :            : 
     189                 :            :         ::std::sort( aProperties.begin(), aProperties.end(),
     190         [ +  - ]:          2 :                      ::chart::PropertyNameLess() );
     191                 :            : 
     192         [ +  - ]:          2 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
     193                 :            :     }
     194                 :            : };
     195                 :            : 
     196                 :            : struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer >
     197                 :            : {
     198                 :            : };
     199                 :            : 
     200                 :            : } // anonymous namespace
     201                 :            : 
     202                 :            : // --------------------------------------------------------------------------------
     203                 :            : 
     204                 :            : namespace chart
     205                 :            : {
     206                 :            : namespace wrapper
     207                 :            : {
     208                 :            : 
     209                 :         31 : TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
     210                 :            :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
     211                 :            :         m_spChart2ModelContact( spChart2ModelContact ),
     212                 :            :         m_aEventListenerContainer( m_aMutex ),
     213 [ +  - ][ +  - ]:         31 :         m_eTitleType(eTitleType)
     214                 :            : {
     215 [ +  - ][ +  - ]:         31 :     ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
                 [ +  - ]
     216 [ +  + ][ +  - ]:         31 :     if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped mapped correctly
     217 [ +  - ][ +  - ]:         31 :         TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
                 [ +  - ]
     218                 :         31 : }
     219                 :            : 
     220 [ +  - ][ +  - ]:         31 : TitleWrapper::~TitleWrapper()
     221                 :            : {
     222         [ -  + ]:         62 : }
     223                 :            : 
     224                 :            : // ____ XShape ____
     225                 :          0 : awt::Point SAL_CALL TitleWrapper::getPosition()
     226                 :            :     throw (uno::RuntimeException)
     227                 :            : {
     228         [ #  # ]:          0 :     return m_spChart2ModelContact->GetTitlePosition( this->getTitleObject() );
     229                 :            : }
     230                 :            : 
     231                 :         15 : void SAL_CALL TitleWrapper::setPosition( const awt::Point& aPosition )
     232                 :            :     throw (uno::RuntimeException)
     233                 :            : {
     234         [ +  - ]:         15 :     Reference< beans::XPropertySet > xPropertySet( this->getInnerPropertySet() );
     235         [ +  - ]:         15 :     if(xPropertySet.is())
     236                 :            :     {
     237         [ +  - ]:         15 :         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
     238                 :            : 
     239                 :         15 :         chart2::RelativePosition aRelativePosition;
     240                 :         15 :         aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
     241                 :         15 :         aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
     242                 :         15 :         aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
     243 [ +  - ][ +  - ]:         15 :         xPropertySet->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
                 [ +  - ]
     244                 :         15 :     }
     245                 :         15 : }
     246                 :            : 
     247                 :          3 : awt::Size SAL_CALL TitleWrapper::getSize()
     248                 :            :     throw (uno::RuntimeException)
     249                 :            : {
     250         [ +  - ]:          3 :     return m_spChart2ModelContact->GetTitleSize( this->getTitleObject() );
     251                 :            : }
     252                 :            : 
     253                 :          0 : void SAL_CALL TitleWrapper::setSize( const awt::Size& /*aSize*/ )
     254                 :            :     throw (beans::PropertyVetoException,
     255                 :            :            uno::RuntimeException)
     256                 :            : {
     257                 :            :     OSL_FAIL( "trying to set size of title" );
     258                 :          0 : }
     259                 :            : 
     260                 :            : // ____ XShapeDescriptor (base of XShape) ____
     261                 :          2 : OUString SAL_CALL TitleWrapper::getShapeType()
     262                 :            :     throw (uno::RuntimeException)
     263                 :            : {
     264                 :          2 :     return rtl::OUString( "com.sun.star.chart.ChartTitle" );
     265                 :            : }
     266                 :            : 
     267                 :            : // ____ XComponent ____
     268                 :         33 : void SAL_CALL TitleWrapper::dispose()
     269                 :            :     throw (uno::RuntimeException)
     270                 :            : {
     271         [ +  - ]:         33 :     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
     272 [ +  - ][ +  - ]:         33 :     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
                 [ +  - ]
     273                 :            : 
     274 [ +  - ][ +  - ]:         33 :     MutexGuard aGuard( GetMutex());
     275 [ +  - ][ +  - ]:         33 :     clearWrappedPropertySet();
     276                 :         33 : }
     277                 :            : 
     278                 :          4 : void SAL_CALL TitleWrapper::addEventListener(
     279                 :            :     const Reference< lang::XEventListener >& xListener )
     280                 :            :     throw (uno::RuntimeException)
     281                 :            : {
     282                 :          4 :     m_aEventListenerContainer.addInterface( xListener );
     283                 :          4 : }
     284                 :            : 
     285                 :          2 : void SAL_CALL TitleWrapper::removeEventListener(
     286                 :            :     const Reference< lang::XEventListener >& aListener )
     287                 :            :     throw (uno::RuntimeException)
     288                 :            : {
     289                 :          2 :     m_aEventListenerContainer.removeInterface( aListener );
     290                 :          2 : }
     291                 :            : 
     292                 :            : // ================================================================================
     293                 :            : 
     294                 :        840 : Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
     295                 :            : {
     296                 :        840 :     Reference< beans::XPropertySet > xProp;
     297                 :            : 
     298         [ +  - ]:        840 :     Reference< chart2::XTitle > xTitle( this->getTitleObject() );
     299         [ +  - ]:        840 :     if( xTitle.is())
     300                 :            :     {
     301 [ +  - ][ +  - ]:        840 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
     302         [ +  - ]:        840 :         if( aStrings.getLength() > 0 )
     303 [ +  - ][ +  - ]:        840 :             xProp.set( aStrings[0], uno::UNO_QUERY );
                 [ +  - ]
     304                 :            :     }
     305                 :            : 
     306                 :        840 :     return xProp;
     307                 :            : }
     308                 :            : 
     309                 :        576 : void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue )
     310                 :            : {
     311                 :            :     OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
     312                 :            :                 nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
     313                 :            : 
     314 [ +  - ][ +  - ]:        576 :     Reference< beans::XPropertySet > xProp( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     315         [ +  - ]:        576 :     Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
     316         [ +  - ]:        576 :     if(xProp.is())
     317                 :            :     {
     318         [ +  - ]:        576 :         const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
     319         [ +  + ]:        576 :         if( pWrappedProperty )
     320                 :            :         {
     321         [ +  - ]:         46 :             rValue = pWrappedProperty->getPropertyValue( xProp );
     322                 :            :         }
     323         [ +  - ]:        530 :         else if( xFastProp.is() )
     324                 :            :         {
     325 [ +  - ][ +  - ]:        530 :             rValue = xFastProp->getFastPropertyValue( nHandle );
     326                 :            :         }
     327                 :        576 :     }
     328                 :            : 
     329                 :        576 : }
     330                 :            : 
     331                 :        448 : void TitleWrapper::setFastCharacterPropertyValue(
     332                 :            :     sal_Int32 nHandle, const Any& rValue ) throw (uno::Exception)
     333                 :            : {
     334                 :            :     OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
     335                 :            :                 nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
     336                 :            : 
     337         [ +  - ]:        448 :     Reference< chart2::XTitle > xTitle( this->getTitleObject() );
     338         [ +  - ]:        448 :     if( xTitle.is())
     339                 :            :     {
     340 [ +  - ][ +  - ]:        448 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
     341         [ +  - ]:        448 :         const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
     342                 :            : 
     343         [ +  + ]:        896 :         for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
     344                 :            :         {
     345 [ +  - ][ +  - ]:        448 :             Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY );
     346         [ +  - ]:        448 :             Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY );
     347                 :            : 
     348         [ +  + ]:        448 :             if( pWrappedProperty )
     349         [ +  - ]:         62 :                 pWrappedProperty->setPropertyValue( rValue, xPropSet );
     350         [ +  - ]:        386 :             else if( xFastPropertySet.is() )
     351 [ +  - ][ +  - ]:        386 :                 xFastPropertySet->setFastPropertyValue( nHandle, rValue );
     352         [ +  - ]:        896 :         }
     353                 :        448 :     }
     354                 :        448 : }
     355                 :            : 
     356                 :            : // ================================================================================
     357                 :            : // WrappedPropertySet
     358                 :            : 
     359                 :        584 : void SAL_CALL TitleWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
     360                 :            :                                     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     361                 :            : {
     362                 :        584 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     363         [ +  + ]:        584 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     364                 :            :     {
     365                 :        448 :         setFastCharacterPropertyValue( nHandle, rValue );
     366                 :            :     }
     367                 :            :     else
     368                 :        136 :         WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
     369                 :        584 : }
     370                 :            : 
     371                 :        620 : Any SAL_CALL TitleWrapper::getPropertyValue( const OUString& rPropertyName )
     372                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     373                 :            : {
     374                 :        620 :     Any aRet;
     375 [ +  - ][ +  - ]:        620 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     376 [ +  - ][ +  + ]:        620 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     377         [ +  - ]:        576 :         getFastCharacterPropertyValue( nHandle, aRet );
     378                 :            :     else
     379         [ +  + ]:         44 :         aRet = WrappedPropertySet::getPropertyValue( rPropertyName );
     380                 :        620 :     return aRet;
     381                 :            : }
     382                 :            : 
     383                 :          0 : beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rPropertyName )
     384                 :            :                                     throw (beans::UnknownPropertyException, uno::RuntimeException)
     385                 :            : {
     386                 :          0 :     beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
     387                 :            : 
     388                 :          0 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     389         [ #  # ]:          0 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     390                 :            :     {
     391 [ #  # ][ #  # ]:          0 :         Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     392         [ #  # ]:          0 :         if( xPropState.is() )
     393                 :            :         {
     394         [ #  # ]:          0 :             const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
     395         [ #  # ]:          0 :             if( pWrappedProperty )
     396         [ #  # ]:          0 :                 aState = pWrappedProperty->getPropertyState( xPropState );
     397                 :            :             else
     398 [ #  # ][ #  # ]:          0 :                 aState = xPropState->getPropertyState( rPropertyName );
     399                 :          0 :         }
     400                 :            :     }
     401                 :            :     else
     402                 :          0 :         aState = WrappedPropertySet::getPropertyState( rPropertyName );
     403                 :            : 
     404                 :          0 :     return aState;
     405                 :            : }
     406                 :          0 : void SAL_CALL TitleWrapper::setPropertyToDefault( const OUString& rPropertyName )
     407                 :            :                                     throw (beans::UnknownPropertyException, uno::RuntimeException)
     408                 :            : {
     409                 :          0 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     410         [ #  # ]:          0 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     411                 :            :     {
     412         [ #  # ]:          0 :         Any aDefault = getPropertyDefault( rPropertyName );
     413         [ #  # ]:          0 :         setFastCharacterPropertyValue( nHandle, aDefault );
     414                 :            :     }
     415                 :            :     else
     416                 :          0 :         WrappedPropertySet::setPropertyToDefault( rPropertyName );
     417                 :          0 : }
     418                 :          0 : Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName )
     419                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     420                 :            : {
     421                 :          0 :     Any aRet;
     422                 :            : 
     423 [ #  # ][ #  # ]:          0 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     424 [ #  # ][ #  # ]:          0 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     425                 :            :     {
     426 [ #  # ][ #  # ]:          0 :         Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     427         [ #  # ]:          0 :         if( xPropState.is() )
     428                 :            :         {
     429         [ #  # ]:          0 :             const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
     430         [ #  # ]:          0 :             if( pWrappedProperty )
     431         [ #  # ]:          0 :                 aRet = pWrappedProperty->getPropertyDefault(xPropState);
     432                 :            :             else
     433 [ #  # ][ #  # ]:          0 :                 aRet = xPropState->getPropertyDefault( rPropertyName );
     434                 :          0 :         }
     435                 :            :     }
     436                 :            :     else
     437         [ #  # ]:          0 :         aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
     438                 :            : 
     439                 :          0 :     return aRet;
     440                 :            : }
     441                 :            : 
     442                 :        140 : void SAL_CALL TitleWrapper::addPropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
     443                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     444                 :            : {
     445                 :        140 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     446         [ +  + ]:        140 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     447                 :            :     {
     448 [ +  - ][ +  - ]:        132 :         Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     449         [ +  - ]:        132 :         if( xPropSet.is() )
     450 [ +  - ][ +  - ]:        132 :             xPropSet->addPropertyChangeListener( rPropertyName, xListener );
     451                 :            :     }
     452                 :            :     else
     453                 :          8 :         WrappedPropertySet::addPropertyChangeListener( rPropertyName, xListener );
     454                 :        140 : }
     455                 :        140 : void SAL_CALL TitleWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
     456                 :            :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     457                 :            : {
     458                 :        140 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     459         [ +  + ]:        140 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     460                 :            :     {
     461 [ +  - ][ +  - ]:        132 :         Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     462         [ +  - ]:        132 :         if( xPropSet.is() )
     463 [ +  - ][ +  - ]:        132 :             xPropSet->removePropertyChangeListener( rPropertyName, xListener );
     464                 :            :     }
     465                 :            :     else
     466                 :          8 :         WrappedPropertySet::removePropertyChangeListener( rPropertyName, xListener );
     467                 :        140 : }
     468                 :            : 
     469                 :            : // ================================================================================
     470                 :            : 
     471                 :            : //ReferenceSizePropertyProvider
     472                 :         62 : void TitleWrapper::updateReferenceSize()
     473                 :            : {
     474 [ +  - ][ +  - ]:         62 :     Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
     475         [ +  - ]:         62 :     if( xProp.is() )
     476                 :            :     {
     477 [ +  - ][ +  - ]:         62 :         if( xProp->getPropertyValue( "ReferencePageSize" ).hasValue() )
                 [ -  + ]
     478         [ #  # ]:          0 :             xProp->setPropertyValue( "ReferencePageSize", uno::makeAny(
     479 [ #  # ][ #  # ]:          0 :                             m_spChart2ModelContact->GetPageSize() ));
                 [ #  # ]
     480                 :         62 :     }
     481                 :         62 : }
     482                 :         46 : Any TitleWrapper::getReferenceSize()
     483                 :            : {
     484                 :         46 :     Any aRet;
     485 [ +  - ][ +  - ]:         46 :     Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
     486         [ +  - ]:         46 :     if( xProp.is() )
     487 [ +  - ][ +  - ]:         46 :         aRet = xProp->getPropertyValue( "ReferencePageSize" );
     488                 :            : 
     489                 :         46 :     return aRet;
     490                 :            : }
     491                 :          0 : awt::Size TitleWrapper::getCurrentSizeForReference()
     492                 :            : {
     493                 :          0 :     return m_spChart2ModelContact->GetPageSize();
     494                 :            : }
     495                 :            : 
     496                 :            : // ================================================================================
     497                 :            : 
     498                 :       1641 : Reference< chart2::XTitle > TitleWrapper::getTitleObject()
     499                 :            : {
     500         [ +  - ]:       1641 :     return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
     501                 :            : }
     502                 :            : 
     503                 :            : // WrappedPropertySet
     504                 :            : 
     505                 :        211 : Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
     506                 :            : {
     507         [ +  - ]:        211 :     return Reference< beans::XPropertySet >( this->getTitleObject(), uno::UNO_QUERY );
     508                 :            : }
     509                 :            : 
     510                 :         14 : const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
     511                 :            : {
     512                 :         14 :     return *StaticTitleWrapperPropertyArray::get();
     513                 :            : }
     514                 :            : 
     515                 :         14 : const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
     516                 :            : {
     517                 :         14 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     518                 :            : 
     519 [ +  - ][ +  - ]:         14 :     aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
                 [ +  - ]
     520 [ +  - ][ +  - ]:         14 :     aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
         [ -  + ][ +  - ]
                 [ +  - ]
     521 [ +  - ][ +  - ]:         14 :     aWrappedProperties.push_back( new WrappedStackedTextProperty() );
                 [ +  - ]
     522         [ +  - ]:         14 :     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     523         [ +  - ]:         14 :     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
     524 [ +  - ][ +  - ]:         14 :     WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
                 [ +  - ]
     525                 :            : 
     526                 :         14 :     return aWrappedProperties;
     527                 :            : }
     528                 :            : 
     529                 :            : // ================================================================================
     530                 :            : 
     531                 :          8 : Sequence< OUString > TitleWrapper::getSupportedServiceNames_Static()
     532                 :            : {
     533                 :          8 :     Sequence< OUString > aServices( 4 );
     534         [ +  - ]:          8 :     aServices[ 0 ] = "com.sun.star.chart.ChartTitle";
     535         [ +  - ]:          8 :     aServices[ 1 ] = "com.sun.star.drawing.Shape";
     536         [ +  - ]:          8 :     aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributeSupplier";
     537         [ +  - ]:          8 :     aServices[ 3 ] = "com.sun.star.style.CharacterProperties";
     538                 :            : 
     539                 :          8 :     return aServices;
     540                 :            : }
     541                 :            : 
     542                 :            : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     543 [ +  - ][ +  - ]:         22 : APPHELPER_XSERVICEINFO_IMPL( TitleWrapper, lcl_aServiceName );
         [ +  + ][ +  - ]
                 [ +  - ]
     544                 :            : 
     545                 :            : } //  namespace wrapper
     546 [ +  - ][ +  - ]:         48 : } //  namespace chart
     547                 :            : 
     548                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10