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

Generated by: LCOV version 1.10