diff options
Diffstat (limited to 'xmloff/source/chart/SchXMLExport.cxx')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 0c5147feeb9e..d31b1ce8d7d9 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -269,6 +269,9 @@ public: OUString msCLSID; + OUString maSrcShellID; + OUString maDestShellID; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; tDataSequenceCont m_aDataSequencesToExport; @@ -1010,6 +1013,16 @@ const OUString& SchXMLExportHelper::getChartCLSID() return m_pImpl->msCLSID; } +void SchXMLExportHelper::SetSourceShellID( const OUString& rShellID ) +{ + m_pImpl->maSrcShellID = rShellID; +} + +void SchXMLExportHelper::SetDestinationShellID( const OUString& rShellID ) +{ + m_pImpl->maDestShellID = rShellID; +} + UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const { return mxPropertySetMapper; @@ -2273,6 +2286,32 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis > xChart2Axis, SvXMLExpo return bExportDateScale; } +void disableLinkedNumberFormat( + std::vector<XMLPropertyState>& rPropStates, const UniReference<XMLPropertySetMapper>& rMapper ) +{ + for (size_t i = 0; i < rPropStates.size(); ++i) + { + XMLPropertyState& rState = rPropStates[i]; + if (rState.mnIndex < 0 || rMapper->GetEntryCount() <= rState.mnIndex) + continue; + + OUString aXMLName = rMapper->GetEntryXMLName(rState.mnIndex); + + if (aXMLName != "link-data-style-to-source") + continue; + + // Entry found. Set the value to false and bail out. + rState.maValue <<= false; + return; + } + + // Entry not found. Insert a new entry for this. + sal_Int32 nIndex = rMapper->GetEntryIndex(XML_NAMESPACE_CHART, "link-data-style-to-source", 0); + XMLPropertyState aState(nIndex); + aState.maValue <<= false; + rPropStates.push_back(aState); +} + } void SchXMLExportHelper_Impl::exportAxis( @@ -2293,6 +2332,14 @@ void SchXMLExportHelper_Impl::exportAxis( { lcl_exportNumberFormat( sNumFormat, xAxisProps, mrExport ); aPropertyStates = mxExpPropMapper->Filter( xAxisProps ); + + if (!maSrcShellID.isEmpty() && !maDestShellID.isEmpty() && maSrcShellID != maDestShellID) + { + // Disable link to source number format property when pasting to + // a different doc shell. These shell ID's should be both empty + // during real ODF export. + disableLinkedNumberFormat(aPropertyStates, mxExpPropMapper->getPropertySetMapper()); + } } bool bExportDateScale = false; @@ -3569,6 +3616,9 @@ SchXMLExport::~SchXMLExport() sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { + maExportHelper.SetSourceShellID(GetSourceShellID()); + maExportHelper.SetDestinationShellID(GetDestinationShellID()); + Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc ); return SvXMLExport::exportDoc( eClass ); |