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

Generated by: LCOV version 1.11