LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - TitleWrapper.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 202 228 88.6 %
Date: 2014-04-11 Functions: 41 47 87.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10