diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-13 11:12:50 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-19 14:46:56 -0400 |
commit | 1d38cb365543924f9c50014e6b2227e77de1d0c9 (patch) | |
tree | 1e77d0d2f82330f16c09cda60864824397d132c4 /chart2/source/controller/chartapiwrapper | |
parent | 2538e30ccc2e98de92de5157ca523fdb347eb537 (diff) |
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
4 files changed, 15 insertions, 71 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 2c10c6126872..4643d6ca5883 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -656,9 +656,8 @@ const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties() aWrappedProperties.push_back( new WrappedProperty("Visible","Show") ); aWrappedProperties.push_back( new WrappedDirectStateProperty("DisplayLabels","DisplayLabels") ); aWrappedProperties.push_back( new WrappedDirectStateProperty("TextBreak","TextBreak") ); - WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact ); - aWrappedProperties.push_back( pWrappedNumberFormatProperty ); - aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) ); + aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) ); + aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) ); aWrappedProperties.push_back( new WrappedProperty("StackedText","StackCharacters") ); aWrappedProperties.push_back( new WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") ); { diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index e8fc2e03dbf1..7199f97d438f 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -697,9 +697,8 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact ); aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) ); - WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact ); - aWrappedProperties.push_back( pWrappedNumberFormatProperty ); - aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) ); + aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) ); + aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) ); } WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact ); diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx index 198dc0cb730d..85d8e7e03848 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx @@ -33,18 +33,11 @@ namespace wrapper WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) : WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, CHART_UNONAME_NUMFMT ) , m_spChart2ModelContact(spChart2ModelContact) - , m_pWrappedLinkNumberFormatProperty(NULL) { - m_aOuterValue = getPropertyDefault( 0 ); } WrappedNumberFormatProperty::~WrappedNumberFormatProperty() { - if( m_pWrappedLinkNumberFormatProperty ) - { - if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty == this ) - m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty = 0; - } } void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const @@ -54,19 +47,8 @@ void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, cons if( ! (rOuterValue >>= nFormat) ) throw lang::IllegalArgumentException( "Property 'NumberFormat' requires value of type sal_Int32", 0, 0 ); - m_aOuterValue = rOuterValue; if(xInnerPropertySet.is()) - { - bool bUseSourceFormat = !xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue(); - if( bUseSourceFormat ) - { - uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); - if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() ) - bUseSourceFormat = false; - } - if( !bUseSourceFormat ) - xInnerPropertySet->setPropertyValue( m_aInnerName, this->convertOuterToInnerValue( rOuterValue ) ); - } + xInnerPropertySet->setPropertyValue(getInnerName(), this->convertOuterToInnerValue(rOuterValue)); } Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const @@ -77,7 +59,7 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue"); return Any(); } - Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName )); + Any aRet( xInnerPropertySet->getPropertyValue(getInnerName())); if( !aRet.hasValue() ) { sal_Int32 nKey = 0; @@ -100,23 +82,14 @@ Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPr return uno::makeAny( sal_Int32( 0 ) ); } -WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty ) : - WrappedProperty( CHART_UNONAME_LINK_TO_SRC_NUMFMT, OUString() ), - m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty ) +WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) : + WrappedDirectStateProperty(CHART_UNONAME_LINK_TO_SRC_NUMFMT, CHART_UNONAME_LINK_TO_SRC_NUMFMT), + m_pChart2ModelContact(pChart2ModelContact) { - if( m_pWrappedNumberFormatProperty ) - { - m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = this; - } } WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty() { - if( m_pWrappedNumberFormatProperty ) - { - if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty == this ) - m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 0; - } } void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const @@ -128,31 +101,7 @@ void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, return; } - bool bLinkFormat = false; - if( rOuterValue >>= bLinkFormat ) - { - Any aValue; - if( bLinkFormat ) - { - if( m_pWrappedNumberFormatProperty ) - { - uno::Reference< chart2::XChartDocument > xChartDoc( m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() ); - if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() ) - return; - } - } - else - { - if( m_pWrappedNumberFormatProperty ) - { - aValue = m_pWrappedNumberFormatProperty->getPropertyValue( xInnerPropertySet ); - } - else - aValue <<= sal_Int32( 0 ); - } - - xInnerPropertySet->setPropertyValue(CHART_UNONAME_NUMFMT, aValue); - } + xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue); } Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const @@ -163,8 +112,8 @@ Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::X OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue"); return getPropertyDefault(0); } - bool bLink = ! xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue(); - return uno::makeAny( bLink ); + + return xInnerPropertySet->getPropertyValue(getInnerName()); } Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx index 618fc074fb09..d721e6b3be37 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx +++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx @@ -49,14 +49,12 @@ public: friend class WrappedLinkNumberFormatProperty; private: ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - mutable ::com::sun::star::uno::Any m_aOuterValue; - WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty; }; -class WrappedLinkNumberFormatProperty : public WrappedProperty +class WrappedLinkNumberFormatProperty : public WrappedDirectStateProperty { public: - WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty ); + WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ); virtual ~WrappedLinkNumberFormatProperty(); virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const @@ -68,9 +66,8 @@ public: virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE; - friend class WrappedNumberFormatProperty; private: - WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty; + boost::shared_ptr<Chart2ModelContact> m_pChart2ModelContact; }; } //namespace wrapper |