LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - TitleWrapper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 202 228 88.6 %
Date: 2014-11-03 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         220 : WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext )
      68             :     : ::chart::WrappedProperty( "String", OUString() )
      69         220 :     , m_xContext( xContext )
      70             : {
      71         220 : }
      72         440 : WrappedTitleStringProperty::~WrappedTitleStringProperty()
      73             : {
      74         440 : }
      75             : 
      76         124 : 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         124 :     Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
      80         124 :     if(xTitle.is())
      81             :     {
      82         124 :         OUString aString;
      83         124 :         rOuterValue >>= aString;
      84         124 :         TitleHelper::setCompleteString( aString, xTitle, m_xContext );
      85         124 :     }
      86         124 : }
      87         292 : Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      88             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      89             : {
      90         292 :     Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
      91         584 :     Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
      92         292 :     if(xTitle.is())
      93             :     {
      94         292 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
      95             : 
      96         584 :         OUStringBuffer aBuf;
      97         632 :         for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
      98             :         {
      99         340 :             aBuf.append( aStrings[ i ]->getString());
     100             :         }
     101         584 :         aRet <<= aBuf.makeStringAndClear();
     102             :     }
     103         584 :     return aRet;
     104             : }
     105         292 : Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     106             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     107             : {
     108         292 :     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         220 : WrappedStackedTextProperty::WrappedStackedTextProperty()
     119         220 :     : ::chart::WrappedProperty( "StackedText", "StackCharacters" )
     120             : {
     121         220 : }
     122         440 : WrappedStackedTextProperty::~WrappedStackedTextProperty()
     123             : {
     124         440 : }
     125             : 
     126             : }// end namespace chart
     127             : 
     128             : namespace
     129             : {
     130          34 : 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          12 : void lcl_AddPropertiesToVector(
     140             :     ::std::vector< Property > & rOutProperties )
     141             : {
     142             :     rOutProperties.push_back(
     143             :         Property( "String",
     144             :                   PROP_TITLE_STRING,
     145          12 :                   cppu::UnoType<OUString>::get(),
     146             :                   beans::PropertyAttribute::BOUND
     147          24 :                   | beans::PropertyAttribute::MAYBEVOID ));
     148             : 
     149             :     rOutProperties.push_back(
     150             :         Property( "TextRotation",
     151             :                   PROP_TITLE_TEXT_ROTATION,
     152          12 :                   cppu::UnoType<sal_Int32>::get(),
     153             :                   beans::PropertyAttribute::BOUND
     154          24 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     155             :     rOutProperties.push_back(
     156             :         Property( "StackedText",
     157             :                   PROP_TITLE_TEXT_STACKED,
     158          12 :                   ::getBooleanCppuType(),
     159             :                   beans::PropertyAttribute::BOUND
     160          24 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     161          12 : }
     162             : 
     163             : struct StaticTitleWrapperPropertyArray_Initializer
     164             : {
     165          12 :     Sequence< Property >* operator()()
     166             :     {
     167          12 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
     168          12 :         return &aPropSeq;
     169             :     }
     170             : 
     171             : private:
     172          12 :     Sequence< Property > lcl_GetPropertySequence()
     173             :     {
     174          12 :         ::std::vector< beans::Property > aProperties;
     175          12 :         lcl_AddPropertiesToVector( aProperties );
     176          12 :         ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
     177          12 :         ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
     178          12 :         ::chart::FillProperties::AddPropertiesToVector( aProperties );
     179          12 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
     180          12 :         ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
     181          12 :         ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
     182             : 
     183             :         ::std::sort( aProperties.begin(), aProperties.end(),
     184          12 :                      ::chart::PropertyNameLess() );
     185             : 
     186          12 :         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         288 : TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
     202             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
     203             :         m_spChart2ModelContact( spChart2ModelContact ),
     204             :         m_aEventListenerContainer( m_aMutex ),
     205         288 :         m_eTitleType(eTitleType)
     206             : {
     207         288 :     ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
     208         288 :     if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped mapped correctly
     209          32 :         TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
     210         288 : }
     211             : 
     212         576 : TitleWrapper::~TitleWrapper()
     213             : {
     214         576 : }
     215             : 
     216             : // ____ XShape ____
     217         232 : awt::Point SAL_CALL TitleWrapper::getPosition()
     218             :     throw (uno::RuntimeException, std::exception)
     219             : {
     220         232 :     return m_spChart2ModelContact->GetTitlePosition( this->getTitleObject() );
     221             : }
     222             : 
     223         162 : void SAL_CALL TitleWrapper::setPosition( const awt::Point& aPosition )
     224             :     throw (uno::RuntimeException, std::exception)
     225             : {
     226         162 :     Reference< beans::XPropertySet > xPropertySet( this->getInnerPropertySet() );
     227         162 :     if(xPropertySet.is())
     228             :     {
     229         162 :         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
     230             : 
     231         162 :         chart2::RelativePosition aRelativePosition;
     232         162 :         aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
     233         162 :         aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
     234         162 :         aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
     235         162 :         xPropertySet->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
     236         162 :     }
     237         162 : }
     238             : 
     239          40 : awt::Size SAL_CALL TitleWrapper::getSize()
     240             :     throw (uno::RuntimeException, std::exception)
     241             : {
     242          40 :     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           2 : OUString SAL_CALL TitleWrapper::getShapeType()
     254             :     throw (uno::RuntimeException, std::exception)
     255             : {
     256           2 :     return OUString( "com.sun.star.chart.ChartTitle" );
     257             : }
     258             : 
     259             : // ____ XComponent ____
     260         290 : void SAL_CALL TitleWrapper::dispose()
     261             :     throw (uno::RuntimeException, std::exception)
     262             : {
     263         290 :     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
     264         290 :     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
     265             : 
     266         580 :     MutexGuard aGuard( GetMutex());
     267         580 :     clearWrappedPropertySet();
     268         290 : }
     269             : 
     270           4 : void SAL_CALL TitleWrapper::addEventListener(
     271             :     const Reference< lang::XEventListener >& xListener )
     272             :     throw (uno::RuntimeException, std::exception)
     273             : {
     274           4 :     m_aEventListenerContainer.addInterface( xListener );
     275           4 : }
     276             : 
     277           2 : void SAL_CALL TitleWrapper::removeEventListener(
     278             :     const Reference< lang::XEventListener >& aListener )
     279             :     throw (uno::RuntimeException, std::exception)
     280             : {
     281           2 :     m_aEventListenerContainer.removeInterface( aListener );
     282           2 : }
     283             : 
     284       28280 : Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
     285             : {
     286       28280 :     Reference< beans::XPropertySet > xProp;
     287             : 
     288       56560 :     Reference< chart2::XTitle > xTitle( this->getTitleObject() );
     289       28280 :     if( xTitle.is())
     290             :     {
     291       28280 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
     292       28280 :         if( aStrings.getLength() > 0 )
     293       28280 :             xProp.set( aStrings[0], uno::UNO_QUERY );
     294             :     }
     295             : 
     296       56560 :     return xProp;
     297             : }
     298             : 
     299        6472 : 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        6472 :     Reference< beans::XPropertySet > xProp( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     305       12944 :     Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
     306        6472 :     if(xProp.is())
     307             :     {
     308        6472 :         const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
     309        6472 :         if( pWrappedProperty )
     310             :         {
     311        1478 :             rValue = pWrappedProperty->getPropertyValue( xProp );
     312             :         }
     313        4994 :         else if( xFastProp.is() )
     314             :         {
     315        4994 :             rValue = xFastProp->getFastPropertyValue( nHandle );
     316             :         }
     317        6472 :     }
     318             : 
     319        6472 : }
     320             : 
     321        1274 : 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        1274 :     Reference< chart2::XTitle > xTitle( this->getTitleObject() );
     328        1274 :     if( xTitle.is())
     329             :     {
     330        1274 :         Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
     331        1274 :         const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
     332             : 
     333        2548 :         for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
     334             :         {
     335        1274 :             Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY );
     336        2548 :             Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY );
     337             : 
     338        1274 :             if( pWrappedProperty )
     339         392 :                 pWrappedProperty->setPropertyValue( rValue, xPropSet );
     340         882 :             else if( xFastPropertySet.is() )
     341         882 :                 xFastPropertySet->setFastPropertyValue( nHandle, rValue );
     342        2548 :         }
     343        1274 :     }
     344        1274 : }
     345             : 
     346             : // WrappedPropertySet
     347             : 
     348        1712 : 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        1712 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     352        1712 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     353             :     {
     354        1274 :         setFastCharacterPropertyValue( nHandle, rValue );
     355             :     }
     356             :     else
     357         438 :         WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
     358        1712 : }
     359             : 
     360        7864 : Any SAL_CALL TitleWrapper::getPropertyValue( const OUString& rPropertyName )
     361             :                                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     362             : {
     363        7864 :     Any aRet;
     364        7864 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     365        7864 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     366        6472 :         getFastCharacterPropertyValue( nHandle, aRet );
     367             :     else
     368        1392 :         aRet = WrappedPropertySet::getPropertyValue( rPropertyName );
     369        7780 :     return aRet;
     370             : }
     371             : 
     372       35464 : beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rPropertyName )
     373             :                                     throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     374             : {
     375       35464 :     beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
     376             : 
     377       35464 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     378       35464 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     379             :     {
     380       21544 :         Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     381       21544 :         if( xPropState.is() )
     382             :         {
     383       21544 :             const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
     384       21544 :             if( pWrappedProperty )
     385        1392 :                 aState = pWrappedProperty->getPropertyState( xPropState );
     386             :             else
     387       20152 :                 aState = xPropState->getPropertyState( rPropertyName );
     388       21544 :         }
     389             :     }
     390             :     else
     391       13920 :         aState = WrappedPropertySet::getPropertyState( rPropertyName );
     392             : 
     393       35464 :     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         140 : 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         140 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     435         140 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     436             :     {
     437         132 :         Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     438         132 :         if( xPropSet.is() )
     439         132 :             xPropSet->addPropertyChangeListener( rPropertyName, xListener );
     440             :     }
     441             :     else
     442           8 :         WrappedPropertySet::addPropertyChangeListener( rPropertyName, xListener );
     443         140 : }
     444         140 : 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         140 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     448         140 :     if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
     449             :     {
     450         132 :         Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
     451         132 :         if( xPropSet.is() )
     452         132 :             xPropSet->removePropertyChangeListener( rPropertyName, xListener );
     453             :     }
     454             :     else
     455           8 :         WrappedPropertySet::removePropertyChangeListener( rPropertyName, xListener );
     456         140 : }
     457             : 
     458             : //ReferenceSizePropertyProvider
     459         392 : void TitleWrapper::updateReferenceSize()
     460             : {
     461         392 :     Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
     462         392 :     if( xProp.is() )
     463             :     {
     464         392 :         if( xProp->getPropertyValue( "ReferencePageSize" ).hasValue() )
     465           0 :             xProp->setPropertyValue( "ReferencePageSize", uno::makeAny(
     466           0 :                             m_spChart2ModelContact->GetPageSize() ));
     467         392 :     }
     468         392 : }
     469        1478 : Any TitleWrapper::getReferenceSize()
     470             : {
     471        1478 :     Any aRet;
     472        2956 :     Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
     473        1478 :     if( xProp.is() )
     474        1478 :         aRet = xProp->getPropertyValue( "ReferencePageSize" );
     475             : 
     476        2956 :     return aRet;
     477             : }
     478           0 : awt::Size TitleWrapper::getCurrentSizeForReference()
     479             : {
     480           0 :     return m_spChart2ModelContact->GetPageSize();
     481             : }
     482             : 
     483       47912 : Reference< chart2::XTitle > TitleWrapper::getTitleObject()
     484             : {
     485       47912 :     return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
     486             : }
     487             : 
     488             : // WrappedPropertySet
     489             : 
     490       15928 : Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
     491             : {
     492       15928 :     return Reference< beans::XPropertySet >( this->getTitleObject(), uno::UNO_QUERY );
     493             : }
     494             : 
     495         220 : const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
     496             : {
     497         220 :     return *StaticTitleWrapperPropertyArray::get();
     498             : }
     499             : 
     500         220 : const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
     501             : {
     502         220 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     503             : 
     504         220 :     aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
     505         220 :     aWrappedProperties.push_back( new WrappedTextRotationProperty( true ) );
     506         220 :     aWrappedProperties.push_back( new WrappedStackedTextProperty() );
     507         220 :     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     508         220 :     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
     509         220 :     WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
     510             : 
     511         220 :     return aWrappedProperties;
     512             : }
     513             : 
     514           8 : Sequence< OUString > TitleWrapper::getSupportedServiceNames_Static()
     515             : {
     516           8 :     Sequence< OUString > aServices( 4 );
     517           8 :     aServices[ 0 ] = "com.sun.star.chart.ChartTitle";
     518           8 :     aServices[ 1 ] = "com.sun.star.drawing.Shape";
     519           8 :     aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
     520           8 :     aServices[ 3 ] = "com.sun.star.style.CharacterProperties";
     521             : 
     522           8 :     return aServices;
     523             : }
     524             : 
     525             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     526          14 : APPHELPER_XSERVICEINFO_IMPL( TitleWrapper, lcl_aServiceName );
     527             : 
     528             : } //  namespace wrapper
     529         102 : } //  namespace chart
     530             : 
     531             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10