diff options
Diffstat (limited to 'chart2/source/controller')
8 files changed, 25 insertions, 77 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 665ea5301656..28226dcce600 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -637,9 +637,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 9b5b622c5d7e..a50778214083 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -698,9 +698,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 a4010a81e4e2..5370d117e39f 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx @@ -33,16 +33,10 @@ WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< C : WrappedDirectStateProperty( "NumberFormat", "NumberFormat" ) , m_spChart2ModelContact(spChart2ModelContact) { - 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 @@ -52,19 +46,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( "NumberFormat" ).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 @@ -75,7 +58,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; @@ -98,23 +81,14 @@ Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPr return uno::makeAny( sal_Int32( 0 ) ); } -WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty ) - : WrappedProperty( "LinkNumberFormatToSource", OUString() ) - , m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty ) +WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) : + WrappedDirectStateProperty("LinkNumberFormatToSource", "LinkNumberFormatToSource"), + 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 @@ -126,31 +100,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( "NumberFormat", aValue ); - } + xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue); } Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const @@ -161,8 +111,8 @@ Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::X OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue"); return getPropertyDefault(0); } - bool bLink = ! xInnerPropertySet->getPropertyValue( "NumberFormat" ).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 63a562c72e87..96020808e9c9 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); - friend class WrappedNumberFormatProperty; private: - WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty; + boost::shared_ptr<Chart2ModelContact> m_pChart2ModelContact; }; } //namespace wrapper diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 328dd8cad1b0..7974dc185c7c 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -425,8 +425,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI case SID_ATTR_NUMBERFORMAT_SOURCE: { - bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( "NumberFormat" ).hasValue()); - rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet )); + bool bLinkToSource = true; + GetPropertySet()->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource; + rOutItemSet.Put(SfxBoolItem(nWhichId, bLinkToSource)); } break; @@ -932,7 +933,9 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet bool bUseSourceFormat = (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() ); - bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( "NumberFormat").hasValue()); + GetPropertySet()->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(bUseSourceFormat)); + + bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue("NumberFormat").hasValue(); bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet); if( bChangedOtherwise ) diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx index 154db84f5955..0857de3f1612 100644 --- a/chart2/source/controller/main/ChartDropTargetHelper.cxx +++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx @@ -103,8 +103,8 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK )) { - Sequence< sal_Int8 > aBytes; - if( aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aBytes )) + Sequence<sal_Int8> aBytes = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString()); + if (aBytes.getLength()) { ::std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes )); if( aStrings.size() >= 3 && aStrings[0] == "soffice" ) diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index f072b2122a48..e7d7d2b91613 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -75,7 +75,7 @@ void ChartTransferable::AddSupportedFormats() AddFormat( SOT_FORMAT_BITMAP ); } -sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); sal_Bool bResult = sal_False; diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx index efbd1b3b9a53..9ae5aaf183fd 100644 --- a/chart2/source/controller/main/ChartTransferable.hxx +++ b/chart2/source/controller/main/ChartTransferable.hxx @@ -43,7 +43,7 @@ protected: // implementation of TransferableHelper methods virtual void AddSupportedFormats(); - virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ); virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); |