diff options
Diffstat (limited to 'chart2')
16 files changed, 84 insertions, 92 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 diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index fe8eeb5bdb9d..e3b71752a751 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -423,8 +423,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI case SID_ATTR_NUMBERFORMAT_SOURCE: { - bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue()); - rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet )); + bool bLinkToSource = true; + GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + rOutItemSet.Put(SfxBoolItem(nWhichId, bLinkToSource)); } break; @@ -930,6 +931,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet bool bUseSourceFormat = (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() ); + GetPropertySet()->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(bUseSourceFormat)); + bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue(); bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet); 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 20f46ac7d2ca..e46796e65053 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -73,7 +73,7 @@ void ChartTransferable::AddSupportedFormats() AddFormat( SOT_FORMAT_BITMAP ); } -bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); bool bResult = false; diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx index b3c3815e4f34..3c54689a07db 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() SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index bc5f4940a33c..a5984edea742 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -541,6 +541,7 @@ sal_Int32 XMLFilter::impl_Export( const Reference< lang::XComponent > & xDocumentComp, const Sequence< beans::PropertyValue > & rMediaDescriptor ) { + m_aMediaDescriptor = rMediaDescriptor; //save sal_Int32 nWarning = 0; @@ -744,9 +745,7 @@ sal_Int32 XMLFilter::impl_ExportStream( if ( !xFilter.is() ) return ERRCODE_SFX_GENERAL; - uno::Sequence < beans::PropertyValue > aMediaDesc(0); - //@todo? filter properties? ... url? ... - xFilter->filter( aMediaDesc ); + xFilter->filter(m_aMediaDescriptor); } catch (const uno::Exception& rEx) { diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx index ad316d0c92b6..4c2c8a1fcefd 100644 --- a/chart2/source/model/inc/XMLFilter.hxx +++ b/chart2/source/model/inc/XMLFilter.hxx @@ -151,6 +151,9 @@ private: ::com::sun::star::lang::XComponent > m_xTargetDoc; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSourceDoc; + + css::uno::Sequence<css::beans::PropertyValue> m_aMediaDescriptor; + OUString m_sDocumentHandler; // when set it will be set as doc handler volatile bool m_bCancelOperation; diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 90e7660b858f..a345bd93f63b 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -67,7 +67,8 @@ enum PROP_AXIS_CROSSOVER_POSITION, PROP_AXIS_CROSSOVER_VALUE, PROP_AXIS_DISPLAY_LABELS, - PROP_AXIS_NUMBER_FORMAT, + PROP_AXIS_NUMBERFORMAT, + PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, PROP_AXIS_LABEL_POSITION, PROP_AXIS_TEXT_ROTATION, PROP_AXIS_TEXT_BREAK, @@ -115,10 +116,17 @@ void lcl_AddPropertiesToVector( rOutProperties.push_back( Property( CHART_UNONAME_NUMFMT, - PROP_AXIS_NUMBER_FORMAT, + PROP_AXIS_NUMBERFORMAT, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEVOID )); + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT, + PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, + ::getBooleanCppuType(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( Property( "LabelPosition", @@ -220,6 +228,7 @@ private: ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS ); ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false ); diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx index 2ebfa95fadbe..e145d4242cdf 100644 --- a/chart2/source/model/main/DataPointProperties.cxx +++ b/chart2/source/model/main/DataPointProperties.cxx @@ -282,7 +282,14 @@ void DataPointProperties::AddPropertiesToVector( PROP_DATAPOINT_NUMBER_FORMAT, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEVOID )); + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT, + PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, + ::getBooleanCppuType(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); //additional 'PercentageNumberFormat' rOutProperties.push_back( @@ -410,6 +417,8 @@ void DataPointProperties::AddDefaultsToMap( PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 ); PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 ); + + PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, true); } } // namespace chart diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx index 596adf88451b..2d7258aca510 100644 --- a/chart2/source/model/main/DataPointProperties.hxx +++ b/chart2/source/model/main/DataPointProperties.hxx @@ -62,6 +62,7 @@ public: PROP_DATAPOINT_LABEL, PROP_DATAPOINT_LABEL_SEPARATOR, PROP_DATAPOINT_NUMBER_FORMAT, + PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT, PROP_DATAPOINT_LABEL_PLACEMENT, PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE, diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index b17952600940..7c72e48860c7 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -458,9 +458,8 @@ void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram if( xAxisProp.is()) { // set number format to source format - uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT); - if( aValue.hasValue()) - xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); + xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true)); + xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); } } } @@ -758,9 +757,8 @@ void ChartTypeTemplate::adaptAxes( if( xAxisProp.is()) { // set number format to source format - uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT); - if( aValue.hasValue()) - xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); + xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true)); + xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); } } } diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 48a3a72e76ca..acc757071ff6 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -143,7 +143,16 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY ); Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); - if( xProp.is() && !( xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey ) ) + if (!xProp.is()) + return 0; + + bool bLinkToSource = true; + xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey; + + sal_Int32 nOldNumberFormat = nNumberFormatKey; + + if (bLinkToSource) { bool bFormatSet = false; //check whether we have a percent scale -> use percent format @@ -316,7 +325,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } } } + + if (nOldNumberFormat != nNumberFormatKey) + xProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nNumberFormatKey)); } + return nNumberFormatKey; } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 4d4c3c8a74ff..9142b3e6e617 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1870,7 +1870,16 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( if( !xSeriesOrPointProp.is() ) return nFormat; - if (!(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat)) + bool bLinkToSource = true; + try + { + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + } + catch ( const beans::UnknownPropertyException& ) {} + + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat; + sal_Int32 nOldFormat = nFormat; + if (bLinkToSource) { uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) ); @@ -1895,7 +1904,11 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); } } + + if (nFormat >= 0 && nOldFormat != nFormat) + xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nFormat)); } + if(nFormat<0) nFormat=0; return nFormat; |