diff options
104 files changed, 674 insertions, 323 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; diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 50a304bd18da..9437893adaa0 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -487,7 +487,9 @@ void EmbeddedObjectContainer::AddEmbeddedObject( const ::com::sun::star::uno::Re } } -bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, bool bCopy ) +bool EmbeddedObjectContainer::StoreEmbeddedObject( + const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, bool bCopy, + const OUString& rSrcShellID, const OUString& rDestShellID ) { uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); if ( rName.isEmpty() ) @@ -506,7 +508,14 @@ bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed: { uno::Sequence < beans::PropertyValue > aSeq; if ( bCopy ) - xPersist->storeToEntry( pImpl->mxStorage, rName, aSeq, aSeq ); + { + uno::Sequence<beans::PropertyValue> aObjArgs(2); + aObjArgs[0].Name = "SourceShellID"; + aObjArgs[0].Value <<= rSrcShellID; + aObjArgs[1].Name = "DestinationShellID"; + aObjArgs[1].Value <<= rDestShellID; + xPersist->storeToEntry(pImpl->mxStorage, rName, aSeq, aObjArgs); + } else { //TODO/LATER: possible optimization, don't store immediately @@ -529,7 +538,7 @@ bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed: bool EmbeddedObjectContainer::InsertEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName ) { // store it into the container storage - if ( StoreEmbeddedObject( xObj, rName, false ) ) + if (StoreEmbeddedObject(xObj, rName, false, OUString(), OUString())) { // remember object AddEmbeddedObject( xObj, rName ); @@ -683,7 +692,9 @@ bool EmbeddedObjectContainer::TryToCopyGraphReplacement( EmbeddedObjectContainer return bResult; } -uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName ) +uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject( + EmbeddedObjectContainer& rSrc, const uno::Reference <embed::XEmbeddedObject>& xObj, OUString& rName, + const OUString& rSrcShellID, const OUString& rDestShellID ) { uno::Reference< embed::XEmbeddedObject > xResult; @@ -703,7 +714,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb rName = CreateUniqueObjectName(); // objects without persistence are not really stored by the method - if ( xObj.is() && StoreEmbeddedObject( xObj, rName, true ) ) + if (xObj.is() && StoreEmbeddedObject(xObj, rName, true, rSrcShellID, rDestShellID)) { xResult = Get_Impl( rName, xObj); if ( !xResult.is() ) diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx index e2cdbbba4395..616f504f6538 100644 --- a/dbaccess/source/ui/browser/dbexchange.cxx +++ b/dbaccess/source/ui/browser/dbexchange.cxx @@ -159,7 +159,7 @@ namespace dbaui ODataAccessObjectTransferable::AddSupportedFormats(); } - bool ODataClipboard::GetData( const DataFlavor& rFlavor ) + bool ODataClipboard::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { const sal_uLong nFormat = SotExchange::GetFormat(rFlavor); switch (nFormat) @@ -175,7 +175,7 @@ namespace dbaui return m_pHtml.is() && SetObject( m_pHtml.get(), SOT_FORMATSTR_ID_HTML, rFlavor ); } - return ODataAccessObjectTransferable::GetData( rFlavor ); + return ODataAccessObjectTransferable::GetData(rFlavor, rDestDoc); } void ODataClipboard::ObjectReleased() diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx index c3434420db20..448a8c7820f3 100644 --- a/dbaccess/source/ui/inc/JoinExchange.hxx +++ b/dbaccess/source/ui/inc/JoinExchange.hxx @@ -61,7 +61,7 @@ namespace dbaui protected: 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 void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx index 4e6c0f7b01f3..0f49ee4515db 100644 --- a/dbaccess/source/ui/inc/TableRowExchange.hxx +++ b/dbaccess/source/ui/inc/TableRowExchange.hxx @@ -34,7 +34,7 @@ namespace dbaui OTableRowExchange(const ::std::vector< ::boost::shared_ptr<OTableRow> >& _rvTableRow); protected: 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; virtual void ObjectReleased() SAL_OVERRIDE; }; diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx index f2dab76f9a65..fa2d9be451c6 100644 --- a/dbaccess/source/ui/inc/dbexchange.hxx +++ b/dbaccess/source/ui/inc/dbexchange.hxx @@ -77,7 +77,7 @@ namespace dbaui protected: 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 void ObjectReleased() SAL_OVERRIDE; virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; }; diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx index 12b5dcdaa01a..e2531a5dce60 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -113,7 +113,7 @@ namespace dbaui AddFormat( SOT_FORMATSTR_ID_SBA_TABID ); } - bool OJoinExchObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) + bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat(rFlavor); if ( SOT_FORMATSTR_ID_SBA_JOIN == nFormat ) diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx index 5c3d1c6a5dbc..e2acae64a14f 100644 --- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx +++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx @@ -52,7 +52,7 @@ namespace dbaui if ( !m_vTableRow.empty() ) AddFormat(SOT_FORMATSTR_ID_SBA_TABED); } - bool OTableRowExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) + bool OTableRowExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uLong nFormat = SotExchange::GetFormat(rFlavor); if(nFormat == SOT_FORMATSTR_ID_SBA_TABED) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 4a057f85f085..cbba5324be88 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -723,12 +723,33 @@ void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< docum m_xRecoveryStorage.clear(); } +namespace { -void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage, - sal_Int32 nStorageFormat, - const OUString& aBaseURL, - const OUString& aHierarchName, - bool bAttachToTheStorage ) +OUString getStringPropertyValue( const uno::Sequence<beans::PropertyValue>& rProps, const OUString& rName ) +{ + OUString aStr; + + for (sal_Int32 i = 0; i < rProps.getLength(); ++i) + { + if (rProps[i].Name == rName) + { + rProps[i].Value >>= aStr; + break; + } + } + + return aStr; +} + +} + +void OCommonEmbeddedObject::StoreDocToStorage_Impl( + const uno::Reference<embed::XStorage>& xStorage, + const uno::Sequence<beans::PropertyValue>& rMediaArgs, + const uno::Sequence<beans::PropertyValue>& rObjArgs, + sal_Int32 nStorageFormat, + const OUString& aHierarchName, + bool bAttachToTheStorage ) { SAL_WARN_IF( !xStorage.is(), "embeddedobj.common", "No storage is provided for storing!" ); @@ -742,6 +763,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } + OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs); + if ( xDoc.is() ) { OUString aFilterName = GetFilterName( nStorageFormat ); @@ -750,13 +773,17 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: - uno::Sequence< beans::PropertyValue > aArgs( 3 ); + uno::Sequence<beans::PropertyValue> aArgs(5); aArgs[0].Name = "FilterName"; aArgs[0].Value <<= aFilterName; - aArgs[2].Name = "DocumentBaseURL"; - aArgs[2].Value <<= aBaseURL; aArgs[1].Name = "HierarchicalDocumentName"; aArgs[1].Value <<= aHierarchName; + aArgs[2].Name = "DocumentBaseURL"; + aArgs[2].Value <<= aBaseURL; + aArgs[3].Name = "SourceShellID"; + aArgs[3].Value <<= getStringPropertyValue(rObjArgs, "SourceShellID"); + aArgs[4].Name = "DestinationShellID"; + aArgs[4].Value <<= getStringPropertyValue(rObjArgs, "DestinationShellID"); xDoc->storeToStorage( xStorage, aArgs ); if ( bAttachToTheStorage ) @@ -1237,7 +1264,8 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed:: aGuard.clear(); // TODO/LATER: support hierarchical name for embedded objects in embedded objects - StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false ); + StoreDocToStorage_Impl( + xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false ); aGuard.reset(); if ( bSwitchBackToLoaded ) @@ -1374,7 +1402,8 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed:: { aGuard.clear(); // TODO/LATER: support hierarchical name for embedded objects in embedded objects - StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false ); + StoreDocToStorage_Impl( + xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false ); aGuard.reset(); if ( bSwitchBackToLoaded ) @@ -1599,7 +1628,8 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn() } aGuard.clear(); - StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, true ); + uno::Sequence<beans::PropertyValue> aEmpty; + StoreDocToStorage_Impl( m_xObjectStorage, aEmpty, aEmpty, nStorageFormat, m_aEntryName, true ); aGuard.reset(); } diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 98354f3eabf4..ceba61e43198 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -195,11 +195,13 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > InitNewDocument_Impl(); - void StoreDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, - sal_Int32 nStorageVersion, - const OUString& aBaseURL, - const OUString& aHierarchName, - bool bAttachToStorage ); + void StoreDocToStorage_Impl( + const css::uno::Reference<css::embed::XStorage>& xStorage, + const css::uno::Sequence<css::beans::PropertyValue>& rMediaArgs, + const css::uno::Sequence<css::beans::PropertyValue>& rObjArgs, + sal_Int32 nStorageVersion, + const OUString& aHierarchName, + bool bAttachToStorage ); void SwitchDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc, diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx index 28be66768510..8895a8d09808 100644 --- a/include/comphelper/embeddedobjectcontainer.hxx +++ b/include/comphelper/embeddedobjectcontainer.hxx @@ -58,7 +58,9 @@ class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer public: // add an embedded object to the container storage - bool StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString&, bool ); + bool StoreEmbeddedObject( + const css::uno::Reference<css::embed::XEmbeddedObject>& xObj, OUString& rName, bool bCopy, + const OUString& rSrcShellID, const OUString& rDestShellID ); // add an embedded object that has been imported from the container storage - should only be called by filters! void AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const OUString& ); @@ -119,7 +121,9 @@ public: InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, OUString& ); // copy an embedded object into the storage, open the new copy and return it - ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, /* TODO const OUString& aOrigName,*/ OUString& rName ); + css::uno::Reference <css::embed::XEmbeddedObject> CopyAndGetEmbeddedObject( + EmbeddedObjectContainer& rSrc, const css::uno::Reference <css::embed::XEmbeddedObject>& xObj, OUString& rName, + const OUString& rSrcShellID, const OUString& rDestShellID ); // move an embedded object from one container to another one bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& ); diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 9c28cc503941..1cb8e910af05 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -218,6 +218,8 @@ public: using SotObject::GetInterface; + static OUString CreateShellID( const SfxObjectShell* pShell ); + // Document-Shell Iterator static SfxObjectShell* GetFirst( const TypeId* pType = 0, bool bOnlyVisible = true ); diff --git a/include/svtools/embedtransfer.hxx b/include/svtools/embedtransfer.hxx index 61622e9098b9..3fd24ce5e058 100644 --- a/include/svtools/embedtransfer.hxx +++ b/include/svtools/embedtransfer.hxx @@ -33,10 +33,12 @@ private: Graphic* m_pGraphic; sal_Int64 m_nAspect; + OUString maParentShellID; + protected: 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 void ObjectReleased() SAL_OVERRIDE; public: @@ -46,6 +48,8 @@ public: sal_Int64 nAspect ); virtual ~SvEmbedTransferHelper(); + void SetParentShellID( const OUString& rShellID ); + static void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, const Graphic* pGraphic, diff --git a/include/svtools/stringtransfer.hxx b/include/svtools/stringtransfer.hxx index 67197be94add..9f3869af6dd2 100644 --- a/include/svtools/stringtransfer.hxx +++ b/include/svtools/stringtransfer.hxx @@ -41,8 +41,8 @@ namespace svt protected: // TransferableHelper overridables - virtual void AddSupportedFormats() SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor ) SAL_OVERRIDE; + virtual void AddSupportedFormats() SAL_OVERRIDE; + virtual bool GetData( const css::datatransfer::DataFlavor& _rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; }; diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx index 8e4965be2be2..03932c561600 100644 --- a/include/svtools/transfer.hxx +++ b/include/svtools/transfer.hxx @@ -29,7 +29,7 @@ #include <cppuhelper/implbase4.hxx> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/datatransfer/XTransferable2.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> @@ -126,7 +126,7 @@ struct ExecuteDropEvent mbDefault( false ) {} }; -class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable, +class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable2, ::com::sun::star::datatransfer::clipboard::XClipboardOwner, ::com::sun::star::datatransfer::dnd::XDragSourceListener, ::com::sun::star::lang::XUnoTunnel > @@ -177,6 +177,11 @@ private: virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // Transferable2 + virtual css::uno::Any SAL_CALL getTransferData2( + const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) + throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -235,7 +240,7 @@ protected: protected: virtual void AddSupportedFormats() = 0; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0; virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); virtual void DragFinished( sal_Int8 nDropAction ); virtual void ObjectReleased(); @@ -311,8 +316,8 @@ public: public: - ::com::sun::star::uno::Any GetAny( SotFormatStringId nFormat ) const; - ::com::sun::star::uno::Any GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const; + css::uno::Any GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const; + css::uno::Any GetAny( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const; bool GetString( SotFormatStringId nFormat, OUString& rStr ); bool GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr ); @@ -349,14 +354,14 @@ public: bool GetFileList( SotFormatStringId nFormat, FileList& rFileList ); bool GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList ); - bool GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq ); - bool GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq ); + css::uno::Sequence<sal_Int8> GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc ); + css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ); bool GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef ); bool GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef ); - bool GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); - bool GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); + css::uno::Reference<css::io::XInputStream> GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc ); + css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ); bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf ); @@ -492,7 +497,7 @@ class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper protected: virtual void AddSupportedFormats() SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; public: diff --git a/include/svx/dbaexchange.hxx b/include/svx/dbaexchange.hxx index b04335d9d0be..801f3eccc3a6 100644 --- a/include/svx/dbaexchange.hxx +++ b/include/svx/dbaexchange.hxx @@ -147,7 +147,7 @@ namespace svx protected: // TransferableHelper overridables 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; static sal_uInt32 getDescriptorFormatId(); @@ -225,7 +225,7 @@ namespace svx protected: virtual void AddSupportedFormats() SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual void ObjectReleased() SAL_OVERRIDE; protected: @@ -275,7 +275,7 @@ namespace svx protected: 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 void ObjectReleased() SAL_OVERRIDE; static sal_uInt32 getDescriptorFormatId(); }; diff --git a/include/svx/dbaobjectex.hxx b/include/svx/dbaobjectex.hxx index a5b9c11730da..a7676209770a 100644 --- a/include/svx/dbaobjectex.hxx +++ b/include/svx/dbaobjectex.hxx @@ -63,7 +63,7 @@ namespace svx protected: // TransferableHelper overridables 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; static sal_uInt32 getDescriptorFormatId(bool _bExtractForm); }; diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx index 4a714dca690f..21e27fa9500e 100644 --- a/include/svx/fmview.hxx +++ b/include/svx/fmview.hxx @@ -108,8 +108,6 @@ public: // for copying complete form structures, not only control models virtual SdrModel* GetMarkedObjModel() const SAL_OVERRIDE; - using E3dView::Paste; - virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE; virtual bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin ) SAL_OVERRIDE; diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index 8c19c4add446..def4f9b01c17 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -176,7 +176,7 @@ protected: // TransferableHelper 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; virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; virtual void ObjectReleased() SAL_OVERRIDE; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 82ee2fbf6768..dc53f0800a9f 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -580,6 +580,9 @@ public: // it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }". // Note that this function uses operator= internally. virtual SdrObject* Clone() const; + + virtual SdrObject* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const; + // implemented mainly for the purposes of Clone() SdrObject& operator=(const SdrObject& rObj); diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index ce4264086ae7..68ad43e7afc8 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -145,7 +145,10 @@ public: virtual OUString TakeObjNameSingul() const SAL_OVERRIDE; virtual OUString TakeObjNamePlural() const SAL_OVERRIDE; - SdrOle2Obj* Clone() const SAL_OVERRIDE; + virtual SdrOle2Obj* Clone() const SAL_OVERRIDE; + virtual SdrOle2Obj* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const SAL_OVERRIDE; + + SdrOle2Obj& assignFrom( const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID ); SdrOle2Obj& operator=(const SdrOle2Obj& rObj); virtual void NbcMove(const Size& rSize) SAL_OVERRIDE; diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx index fa18cb5631b5..f92a2f0c1f5b 100644 --- a/include/svx/svdxcgv.hxx +++ b/include/svx/svdxcgv.hxx @@ -103,7 +103,10 @@ public: // View angezeigt wird. // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und // SDRINSERT_ADDMARK (siehe svdedtv.hxx). - virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0); + virtual bool Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ); + bool Paste(const OUString& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0); bool Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0); diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx index 4681121416b6..faf43db81661 100644 --- a/include/svx/view3d.hxx +++ b/include/svx/view3d.hxx @@ -98,7 +98,9 @@ public: // On Paste: We need to insert the objects of the Scene, but not the Scene itself using SdrView::Paste; - virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE; + virtual bool Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE; // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...) bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset); diff --git a/include/svx/xmlexchg.hxx b/include/svx/xmlexchg.hxx index 2c7f30d2a7d2..7de6e3ab923c 100644 --- a/include/svx/xmlexchg.hxx +++ b/include/svx/xmlexchg.hxx @@ -69,7 +69,7 @@ namespace svx // TransferableHelper overridables 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; OXFormsDescriptor m_aDescriptor; diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx index d46663f10cee..af866be30304 100644 --- a/include/xmloff/SchXMLExportHelper.hxx +++ b/include/xmloff/SchXMLExportHelper.hxx @@ -52,6 +52,9 @@ public: /// returns the string corresponding to the current FileFormat CLSID for Chart const OUString& getChartCLSID(); + void SetSourceShellID( const OUString& rShellID ); + void SetDestinationShellID( const OUString& rShellID ); + private: SchXMLExportHelper(); // not defined SchXMLExportHelper(SchXMLExportHelper &); // not defined diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index d0b02456e6f5..0e5060d72517 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -210,6 +210,9 @@ protected: // This method must be overloaded to export the content of <office:body>. virtual void _ExportContent() = 0; + OUString GetSourceShellID() const; + OUString GetDestinationShellID() const; + void SetExtended( bool bSet=true ) { mbExtended = bSet; } // save linked sections? (may be false in global documents) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 3ce5e0647b24..8a07f150dd4b 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2112,6 +2112,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/datatransfer,\ XSystemTransferable \ XTransferDataAccess \ XTransferable \ + XTransferable2 \ XTransferableEx \ XTransferableSource \ XTransferableSupplier \ diff --git a/offapi/com/sun/star/datatransfer/XTransferable2.idl b/offapi/com/sun/star/datatransfer/XTransferable2.idl new file mode 100644 index 000000000000..5ff7d58dc826 --- /dev/null +++ b/offapi/com/sun/star/datatransfer/XTransferable2.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __com_sun_star_datatransfer_XTransferable2_idl__ +#define __com_sun_star_datatransfer_XTransferable2_idl__ + +#include <com/sun/star/datatransfer/XTransferable2.idl> + +module com { module sun { module star { module datatransfer { + +interface XTransferable2 : com::sun::star::datatransfer::XTransferable +{ + /** This is equivalent of getTransferData of XTransferable, but takes an + additional parameter that specifies the destination document type. + + @param aFlavor requested data format + @param aDestShellID destination document shell ID. The ID of each + individual shell must be unique. + + @returns data in specified data format. + + @throws com::sun::star::io::IOException + if the data is no longer available in the requested flavor. + + @throws com::sun::star::datatransfer::UnsupportedFlavorException + if the requested DataFlavor is not supported. + */ + any getTransferData2( [in] DataFlavor aFlavor, [in] string aDestShellID ) + raises ( UnsupportedFlavorException, com::sun::star::io::IOException ); +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/reportdesign/source/ui/dlg/GroupExchange.cxx b/reportdesign/source/ui/dlg/GroupExchange.cxx index 979dd5c65cde..75ab80ea094d 100644 --- a/reportdesign/source/ui/dlg/GroupExchange.cxx +++ b/reportdesign/source/ui/dlg/GroupExchange.cxx @@ -49,7 +49,7 @@ namespace rptui } } - bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) + bool OGroupExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uLong nFormat = SotExchange::GetFormat(rFlavor); if(nFormat == OGroupExchange::getReportGroupId() ) diff --git a/reportdesign/source/ui/dlg/GroupExchange.hxx b/reportdesign/source/ui/dlg/GroupExchange.hxx index 57259b504684..39c206be49c6 100644 --- a/reportdesign/source/ui/dlg/GroupExchange.hxx +++ b/reportdesign/source/ui/dlg/GroupExchange.hxx @@ -37,7 +37,7 @@ namespace rptui static sal_uInt32 getReportGroupId(); protected: 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 void ObjectReleased() SAL_OVERRIDE; }; } diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index a77fcadb1cc8..6a0a18c791f8 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -272,7 +272,7 @@ sal_Int8 OFieldExpressionControl::ExecuteDrop( const BrowserExecuteDropEvent& rE SetNoSelection(); TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable ); - uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId()); + uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId(), OUString()); uno::Sequence< uno::Any > aGroups; aDrop >>= aGroups; if ( aGroups.getLength() ) @@ -865,7 +865,7 @@ void OFieldExpressionControl::InsertRows( long nRow ) SotExchange::GetFormatDataFlavor(OGroupExchange::getReportGroupId(), aFlavor); uno::Sequence< uno::Any > aGroups; - if( (aTransferData.GetAny(aFlavor) >>= aGroups) && aGroups.getLength() ) + if ((aTransferData.GetAny(aFlavor, OUString()) >>= aGroups) && aGroups.getLength()) { m_bIgnoreEvent = false; { diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx index 4ac25e4bf888..39609c053fc1 100644 --- a/reportdesign/source/ui/inc/dlgedclip.hxx +++ b/reportdesign/source/ui/inc/dlgedclip.hxx @@ -70,7 +70,7 @@ public: protected: // TransferableHelper overridables 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; private: TSectionElements m_aCopyElements; }; diff --git a/reportdesign/source/ui/report/dlgedclip.cxx b/reportdesign/source/ui/report/dlgedclip.cxx index a605094e39b4..5d95b0dbea35 100644 --- a/reportdesign/source/ui/report/dlgedclip.cxx +++ b/reportdesign/source/ui/report/dlgedclip.cxx @@ -52,7 +52,7 @@ void OReportExchange::AddSupportedFormats() AddFormat(getDescriptorFormatId()); } -bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor ) +bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); return (nFormatId == getDescriptorFormatId()) && SetAny( uno::Any(m_aCopyElements), _rFlavor ); @@ -76,7 +76,7 @@ OReportExchange::TSectionElements OReportExchange::extractCopies(const Transfera SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor); OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid data format (no flavor)!"); - uno::Any aDescriptor = _rData.GetAny(aFlavor); + uno::Any aDescriptor = _rData.GetAny(aFlavor, OUString()); TSectionElements aCopies; #if OSL_DEBUG_LEVEL > 0 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index e4e956b104bb..3c636eb80098 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -27,6 +27,7 @@ #include "types.hxx" #include "mtvelements.hxx" #include <formula/types.hxx> +#include <svl/zforlist.hxx> #include <set> #include <vector> @@ -232,7 +233,10 @@ public: void CopyToClip( sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const; - void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol); + + void CopyStaticToDocument( + SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol ); + void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol ); bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos ); bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 9d032d545263..700086dae7f1 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -40,6 +40,7 @@ #include "calcconfig.hxx" #include <tools/fract.hxx> #include <tools/gen.hxx> +#include <svl/zforlist.hxx> #include <memory> #include <map> diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 14bdbe5614d5..3d70c4936549 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -412,7 +412,11 @@ public: void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag); void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable ); void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable ); - void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab); + + void CopyStaticToDocument( + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, + ScTable* pDestTab ); + void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab ); bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 0bc27bb0f464..0f5bc92f5291 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1040,7 +1040,8 @@ void ScColumn::CopyToClip( rColumn.CellStorageModified(); } -void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) +void ScColumn::CopyStaticToDocument( + SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol ) { if (nRow1 > nRow2) return; @@ -1149,6 +1150,17 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol break; } + // Dont' forget to copy the number formats over. Charts may reference them. + for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + { + sal_uInt32 nNumFmt = GetNumberFormat(nRow); + SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt); + if (itNum != rMap.end()) + nNumFmt = itNum->second; + + rDestCol.SetNumberFormat(nRow, nNumFmt); + } + rDestCol.CellStorageModified(); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 4df3001cecf9..fa71aa0d3c66 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2157,8 +2157,12 @@ void ScDocument::CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab, if (!pSrcTab || !pDestTab) return; + pDestDoc->GetFormatTable()->MergeFormatter(*GetFormatTable()); + SvNumberFormatterMergeMap aMap = pDestDoc->GetFormatTable()->ConvertMergeTableToMap(); + pSrcTab->CopyStaticToDocument( - rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(), pDestTab); + rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(), + aMap, pDestTab); } void ScDocument::CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc ) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index b16aaa245d71..4c75534b5970 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -556,7 +556,8 @@ void ScTable::CopyToClip( } } -void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab) +void ScTable::CopyStaticToDocument( + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScTable* pDestTab ) { if (nCol1 > nCol2) return; @@ -565,7 +566,7 @@ void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW { ScColumn& rSrcCol = aCol[i]; ScColumn& rDestCol = pDestTab->aCol[i]; - rSrcCol.CopyStaticToDocument(nRow1, nRow2, rDestCol); + rSrcCol.CopyStaticToDocument(nRow1, nRow2, rMap, rDestCol); } } diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 40d48088b8dc..5288b1d7ac5f 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -91,7 +91,8 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain pDragSourceView( NULL ), nDragSourceFlags( 0 ), bDragWasInternal( false ), - nSourceDocID( 0 ) + nSourceDocID( 0 ), + maShellID(SfxObjectShell::CreateShellID(pContainerShell)) { // check what kind of objects are contained @@ -335,12 +336,8 @@ void ScDrawTransferObj::AddSupportedFormats() AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); AddFormat( SOT_FORMAT_GDIMETAFILE ); - if ( !aOleData.GetTransferable().is() ) - { - SdrOle2Obj* pObj = GetSingleObject(); - if ( pObj && pObj->GetObjRef().is() ) - aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ; - } + CreateOLEData(); + if ( aOleData.GetTransferable().is() ) { // get format list from object snapshot @@ -372,19 +369,14 @@ void ScDrawTransferObj::AddSupportedFormats() // AddFormat( SOT_FORMATSTR_ID_SVIM ); } -bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) { bool bOK = false; sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); if ( bOleObj && nFormat != SOT_FORMAT_GDIMETAFILE ) { - if ( !aOleData.GetTransferable().is() ) - { - SdrOle2Obj* pObj = GetSingleObject(); - if ( pObj && pObj->GetObjRef().is() ) - aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ; - } + CreateOLEData(); if( aOleData.GetTransferable().is() && aOleData.HasFormat( rFlavor ) ) { @@ -396,7 +388,7 @@ bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavo pModel->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE ); } - bOK = SetAny( aOleData.GetAny( rFlavor ), rFlavor ); + bOK = SetAny( aOleData.GetAny(rFlavor, rDestDoc), rFlavor ); if( pModel ) pModel->SetSwapGraphicsMode( nOldSwapMode ); @@ -697,6 +689,11 @@ void ScDrawTransferObj::SetDragWasInternal() bDragWasInternal = true; } +OUString ScDrawTransferObj::GetShellID() const +{ + return maShellID; +} + SdrOle2Obj* ScDrawTransferObj::GetSingleObject() { // if single OLE object was copied, get its object @@ -715,6 +712,26 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject() return NULL; } +void ScDrawTransferObj::CreateOLEData() +{ + if (aOleData.GetTransferable().is()) + // Already created. + return; + + SdrOle2Obj* pObj = GetSingleObject(); + if (!pObj || !pObj->GetObjRef().is()) + // No OLE object present. + return; + + SvEmbedTransferHelper* pEmbedTransfer = + new SvEmbedTransferHelper( + pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect()); + + pEmbedTransfer->SetParentShellID(maShellID); + + aOleData = TransferableDataHelper(pEmbedTransfer); +} + // initialize aDocShellRef with a live document from the ClipDoc @@ -736,7 +753,10 @@ void ScDrawTransferObj::InitDocShell() // SdrExchangeView aDestView( pDestModel ); SdrView aDestView( pDestModel ); aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0)); - aDestView.Paste( *pModel, Point( aSrcSize.Width()/2, aSrcSize.Height()/2 ) ); + aDestView.Paste( + *pModel, + Point(aSrcSize.Width()/2, aSrcSize.Height()/2), + NULL, 0, OUString(), OUString()); // put objects to right layer (see ScViewFunc::PasteDataFormat for SOT_FORMATSTR_ID_DRAWING) diff --git a/sc/source/ui/app/lnktrans.cxx b/sc/source/ui/app/lnktrans.cxx index 734d9b718a5c..69a5cbe1d4a8 100644 --- a/sc/source/ui/app/lnktrans.cxx +++ b/sc/source/ui/app/lnktrans.cxx @@ -53,7 +53,8 @@ void ScLinkTransferObj::AddSupportedFormats() } } -bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool ScLinkTransferObj::GetData( + const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { bool bOK = false; if ( !aLinkURL.isEmpty() ) diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 0140ab587e7f..2008695ecf53 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -389,7 +389,8 @@ ScDrawTransferObj* ScSelectionTransferObj::GetDrawData() return pDrawData; } -bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool ScSelectionTransferObj::GetData( + const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) { bool bOK = false; @@ -416,7 +417,7 @@ bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::Data if ( xSource.is() ) { TransferableDataHelper aHelper( xSource ); - uno::Any aAny = aHelper.GetAny( rFlavor ); + uno::Any aAny = aHelper.GetAny(rFlavor, rDestDoc); bOK = SetAny( aAny, rFlavor ); } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index a538cd30afed..1d3bb94e2906 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -241,7 +241,7 @@ void ScTransferObj::AddSupportedFormats() AddFormat( SOT_FORMATSTR_ID_EDITENGINE ); } -bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor ) +bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); bool bOK = false; diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx index 5b71558c655a..efca06767e1c 100644 --- a/sc/source/ui/inc/drwtrans.hxx +++ b/sc/source/ui/inc/drwtrans.hxx @@ -63,17 +63,20 @@ private: ScRangeListVector m_aProtectedChartRangesVector; + OUString maShellID; void InitDocShell(); SdrOle2Obj* GetSingleObject(); + void CreateOLEData(); + public: ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContainerShell, const TransferableObjectDescriptor& rDesc ); virtual ~ScDrawTransferObj(); 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; virtual void ObjectReleased() SAL_OVERRIDE; @@ -87,6 +90,8 @@ public: void SetDragSourceFlags( sal_uInt16 nFlags ); void SetDragWasInternal(); + OUString GetShellID() const; + SdrView* GetDragSourceView() { return pDragSourceView; } sal_uInt16 GetDragSourceFlags() const { return nDragSourceFlags; } diff --git a/sc/source/ui/inc/lnktrans.hxx b/sc/source/ui/inc/lnktrans.hxx index 2e47e41649e8..033da1b9ebbe 100644 --- a/sc/source/ui/inc/lnktrans.hxx +++ b/sc/source/ui/inc/lnktrans.hxx @@ -36,7 +36,7 @@ public: void SetLinkURL( const OUString& rURL, const OUString& rText ); 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 void ObjectReleased() SAL_OVERRIDE; virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; }; diff --git a/sc/source/ui/inc/seltrans.hxx b/sc/source/ui/inc/seltrans.hxx index e7eb1ed92bee..3abfd11a8873 100644 --- a/sc/source/ui/inc/seltrans.hxx +++ b/sc/source/ui/inc/seltrans.hxx @@ -65,7 +65,7 @@ public: ScDrawTransferObj* GetDrawData(); 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 void ObjectReleased() SAL_OVERRIDE; }; diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index debff33d5b93..6ee2855b7d0c 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -72,7 +72,7 @@ public: virtual ~ScTransferObj(); 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; virtual void ObjectReleased() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index e686a0118d5b..6cf382509c19 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -119,8 +119,8 @@ public: ::com::sun::star::datatransfer::XTransferable >& rxTransferable ); void PasteDraw(); - void PasteDraw( const Point& rLogicPos, SdrModel* pModel, - bool bGroup = false, bool bSameDocClipboard = false ); + void PasteDraw( const Point& rLogicPos, SdrModel* pModel, bool bGroup, + const OUString& rSrcShellID, const OUString& rDestShellID ); bool PasteOnDrawObjectLinked( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index d6730ae3917b..219f79442a1c 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4433,7 +4433,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) bPasteIsMove = bIsMove; - pViewData->GetView()->PasteDraw( aLogicPos, rData.pDrawTransfer->GetModel() ); + pViewData->GetView()->PasteDraw( + aLogicPos, rData.pDrawTransfer->GetModel(), false, "A", "B"); if (bPasteIsMove) rData.pDrawTransfer->SetDragWasInternal(); @@ -4536,8 +4537,9 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel ) // bSameDocClipboard argument for PasteDraw is needed // because only DragData is checked directly inside PasteDraw - pViewData->GetView()->PasteDraw( aLogicPos, pDrawTransfer->GetModel(), false, - pDrawTransfer->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() ); + pViewData->GetView()->PasteDraw( + aLogicPos, pDrawTransfer->GetModel(), false, + pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell())); } } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index d82e72558612..be5d96c68218 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -447,8 +447,11 @@ void ScViewFunc::PasteDraw() pViewData->GetActivePart() ) ); ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin ); if (pDrawClip) - PasteDraw( aPos, pDrawClip->GetModel(), false, - pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() ); + { + OUString aSrcShellID = pDrawClip->GetShellID(); + OUString aDestShellID = SfxObjectShell::CreateShellID(pViewData->GetDocShell()); + PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID); + } } void ScViewFunc::PasteFromSystem() @@ -584,7 +587,9 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran SCROW nPosY = pViewData->GetCurY(); Window* pWin = GetActiveWin(); Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, pViewData->GetActivePart() ) ); - PasteDraw( aPos, pDrawClip->GetModel(), false, pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() ); + PasteDraw( + aPos, pDrawClip->GetModel(), false, + pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell())); } else { diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index dc708e0e96b4..9d398119e296 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -117,8 +117,10 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, uno::Reference < io::XInputStream > xStm; TransferableObjectDescriptor aObjDesc; - if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) && - aDataHelper.GetInputStream( nFormatId, xStm ) ) + if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc)) + xStm = aDataHelper.GetInputStream(nFormatId, OUString()); + + if (xStm.is()) { if ( aObjDesc.maClassName == SvGlobalName( SO3_SC_CLASSID_60 ) ) { @@ -209,9 +211,11 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, { OUString aName; uno::Reference < embed::XEmbeddedObject > xObj; + xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString()); + if (!xStm.is()) + aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString()); - if ( aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) - || aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) ) + if (xStm.is()) { xObj = GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); } @@ -518,7 +522,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, nObjCount += pPage->GetObjCount(); // count group object only once } - PasteDraw( aPos, pModel.get(), (nObjCount > 1) ); // grouped if more than 1 object + PasteDraw(aPos, pModel.get(), (nObjCount > 1), "A", "B"); // grouped if more than 1 object pModel.reset(); aDragShellRef->DoClose(); bRet = true; @@ -528,8 +532,8 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, { // do excel import into a clipboard document //TODO/MBA: testing - uno::Reference < io::XInputStream > xStm; - if( aDataHelper.GetInputStream( nFormatId, xStm ) ) + uno::Reference <io::XInputStream> xStm = aDataHelper.GetInputStream(nFormatId, OUString()); + if (xStm.is()) { ScDocument* pInsDoc = new ScDocument( SCDOCMODE_CLIP ); SCTAB nSrcTab = 0; // Biff5 in clipboard: always sheet 0 @@ -629,8 +633,8 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r // get link data from transferable before string data, // so the source knows it will be used for a link - uno::Sequence<sal_Int8> aSequence; - if ( !aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aSequence ) ) + uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString()); + if (!aSequence.getLength()) { OSL_FAIL("DDE Data not found."); return false; diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 4cf39cf8a205..8799d59c191d 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -74,8 +74,10 @@ static void lcl_AdjustInsertPos( ScViewData* pData, Point& rPos, Size& rSize ) } void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, - bool bGroup, bool bSameDocClipboard ) + bool bGroup, const OUString& rSrcShellID, const OUString& rDestShellID ) { + bool bSameDocClipboard = rSrcShellID == rDestShellID; + MakeDrawLayer(); Point aPos( rLogicPos ); @@ -221,7 +223,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if ( !bSameDocClipboard ) GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( true ); - pScDrawView->Paste( *pModel, aPos, NULL, nOptions ); + pScDrawView->Paste(*pModel, aPos, NULL, nOptions, rSrcShellID, rDestShellID); if ( !bSameDocClipboard ) GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false ); diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index bc2af1cffc63..65b6ff7d5a01 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1095,7 +1095,7 @@ bool SdDrawDocument::InsertBookmarkAsObject( pBMView->GetDoc().SetAllocDocSh(true); SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetMarkedObjModel(); - bOK = pView->Paste(*pTmpDoc, aObjPos, pPage); + bOK = pView->Paste(*pTmpDoc, aObjPos, pPage, 0, OUString(), OUString()); if (bOLEObjFound) pBMView->GetDoc().SetAllocDocSh(false); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index cff6d88dea58..08acf398b9e6 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -448,7 +448,7 @@ void SdTransferable::AddSupportedFormats() } } -bool SdTransferable::GetData( const DataFlavor& rFlavor ) +bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { if (SD_MOD()==NULL) return false; @@ -476,7 +476,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor ) if( nFormat == FORMAT_GDIMETAFILE && mpGraphic ) bOK = SetGDIMetaFile( mpGraphic->GetGDIMetaFile(), rFlavor ); else - bOK = SetAny( mpOLEDataHelper->GetAny( rFlavor ), rFlavor ); + bOK = SetAny( mpOLEDataHelper->GetAny(rFlavor, rDestDoc), rFlavor ); if( mpSdDrawDocumentIntern ) mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode ); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 83978f8f0540..370c0da71fc9 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -125,7 +125,7 @@ void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats() -bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uLong nFormatId = SotExchange::GetFormat( rFlavor ); switch (nFormatId) diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx index 2ec16b904d42..1700921dfee5 100644 --- a/sd/source/ui/inc/TabControl.hxx +++ b/sd/source/ui/inc/TabControl.hxx @@ -95,7 +95,7 @@ private: virtual ~TabControlTransferable(); 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 void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; }; diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 80dd74e77716..b78671d48566 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -195,7 +195,10 @@ public: virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE; virtual SdrModel* GetMarkedObjModel() const SAL_OVERRIDE; - virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE; + virtual bool Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE; + using SdrExchangeView::Paste; /** returns true if we have an undo manager and there is an open list undo action */ diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index be54329fdde6..8a40c6037f45 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -100,7 +100,7 @@ public: SAL_DLLPRIVATE virtual ~SdPageObjsTransferable(); SAL_DLLPRIVATE virtual void AddSupportedFormats() SAL_OVERRIDE; - SAL_DLLPRIVATE virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + SAL_DLLPRIVATE virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index 095beecf83dd..d9aa56e3826c 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -106,7 +106,7 @@ public: protected: 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; virtual void ObjectReleased() SAL_OVERRIDE; diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 631a238e97c8..9fdad1d90b76 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -976,9 +976,11 @@ SdrModel* View::GetMarkedObjModel() const return FmFormView::GetMarkedObjModel();; } -bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */) +bool View::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { - return FmFormView::Paste( rMod, rPos, pLst,nOptions );; + return FmFormView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID); } } // end of namespace sd diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index bce24cd103dc..315433c93223 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -604,7 +604,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel(); pSourceDoc->CreatingDataObj( pOwnData ); SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetMarkedObjModel(); - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -645,7 +645,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pWorkModel->DeletePage( (sal_uInt16) i ); } - bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -804,7 +804,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ); } - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); } xShell->DoClose(); @@ -845,9 +845,15 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, uno::Reference < io::XInputStream > xStm; TransferableObjectDescriptor aObjDesc; - if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) && - ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) || - aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) ) + if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc)) + { + OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh()); + xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, aDocShellID); + if (!xStm.is()) + xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ, aDocShellID); + } + + if (xStm.is()) { if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) ) { @@ -881,7 +887,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pModel->DeletePage( (sal_uInt16) i ); } - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -1030,8 +1036,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, uno::Reference < embed::XEmbeddedObject > xObj; OUString aName; - if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) || - aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) ) + xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString()); + if (!xStm.is()) + xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString()); + + if (xStm.is()) { xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); } @@ -1504,7 +1513,7 @@ bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nP pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); CreateTableFromRTF( *xStm, pModel.get() ); - bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); xComponent->dispose(); xComponent.clear(); diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 827739acff84..2df6a85b04b7 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -62,7 +62,7 @@ void TabControl::TabControlTransferable::AddSupportedFormats() -bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& ) +bool TabControl::TabControlTransferable::GetData( const css::datatransfer::DataFlavor& /*rFlavor*/, const OUString& /*rDestDoc*/ ) { return false; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index ef40d7335b32..e3eff9571c23 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -474,7 +474,24 @@ bool SfxObjectShell::Close() return true; } +OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell ) +{ + if (!pShell) + return OUString(); + + OUString aShellID; + + SfxMedium* pMedium = pShell->GetMedium(); + if (pMedium) + aShellID = pMedium->GetBaseURL(); + if (!aShellID.isEmpty()) + return aShellID; + + sal_Int64 nShellID = reinterpret_cast<sal_Int64>(pShell); + aShellID = "0x" + OUString::number(nShellID, 16); + return aShellID; +} // returns a pointer the first SfxDocument of specified type diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index f7617d4ffa0c..1de12e66c507 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1570,8 +1570,10 @@ void SmViewShell::Execute(SfxRequest& rReq) if( aData.GetTransferable().is() && ( aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBEDDED_OBJ ) || (aData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) && - aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE ))) && - aData.GetInputStream( nId, xStrm ) && xStrm.is() ) + aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE )))) + xStrm = aData.GetInputStream(nId, OUString()); + + if (xStrm.is()) { try { diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 269259198dc4..f27e41990591 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1243,9 +1243,8 @@ sal_Int8 SvTreeListBox::ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); if( aData.HasFormat( SOT_FORMATSTR_ID_TREELISTBOX )) { - ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; - if( aData.GetSequence( SOT_FORMATSTR_ID_TREELISTBOX, aSeq ) && - sizeof(SvLBoxDDInfo) == aSeq.getLength() ) + css::uno::Sequence<sal_Int8> aSeq = aData.GetSequence(SOT_FORMATSTR_ID_TREELISTBOX, OUString()); + if (sizeof(SvLBoxDDInfo) == aSeq.getLength()) { memcpy( &aDDInfo, aSeq.getConstArray(), sizeof(SvLBoxDDInfo) ); nRet = rEvt.mnAction; diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index 767ab0e57c58..c7d9aa09719d 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -293,7 +293,7 @@ bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData, O uno::Any aAny; if( rData.HasFormat( aFlavor ) && - ( aAny = rData.GetAny( aFlavor ) ).hasValue() ) + ( aAny = rData.GetAny(aFlavor, OUString()) ).hasValue() ) { uno::Sequence< sal_Int8 > anySequence; aAny >>= anySequence; diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index aa2375ba5317..7792f84032b0 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -65,6 +65,10 @@ SvEmbedTransferHelper::~SvEmbedTransferHelper() } } +void SvEmbedTransferHelper::SetParentShellID( const OUString& rShellID ) +{ + maParentShellID = rShellID; +} void SvEmbedTransferHelper::AddSupportedFormats() @@ -76,7 +80,7 @@ void SvEmbedTransferHelper::AddSupportedFormats() -bool SvEmbedTransferHelper::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) { bool bRet = false; @@ -109,7 +113,12 @@ bool SvEmbedTransferHelper::GetData( const ::com::sun::star::datatransfer::DataF SvStream* pStream = NULL; bool bDeleteStream = false; uno::Sequence < beans::PropertyValue > aEmpty; - xPers->storeToEntry( xStg, aName, aEmpty, aEmpty ); + uno::Sequence<beans::PropertyValue> aObjArgs(2); + aObjArgs[0].Name = "SourceShellID"; + aObjArgs[0].Value <<= maParentShellID; + aObjArgs[1].Name = "DestinationShellID"; + aObjArgs[1].Value <<= rDestDoc; + xPers->storeToEntry(xStg, aName, aEmpty, aObjArgs); if ( xStg->isStreamElement( aName ) ) { uno::Reference < io::XStream > xStm = xStg->cloneStreamElement( aName ); diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index 44349ae3e2e3..f6f614e8095b 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -44,7 +44,7 @@ namespace svt } - bool OStringTransferable::GetData( const DataFlavor& _rFlavor ) + bool OStringTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( _rFlavor ); if (SOT_FORMAT_STRING == nFormat) diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index c210cc78efa2..5a916b6ad4de 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp> #include <com/sun/star/datatransfer/XMimeContentType.hpp> +#include <com/sun/star/datatransfer/XTransferable2.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -299,8 +300,14 @@ TransferableHelper::~TransferableHelper() } +Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) + throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception) +{ + return getTransferData2(rFlavor, OUString()); +} -Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) throw( UnsupportedFlavorException, IOException, RuntimeException, std::exception ) +Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, const OUString& rDestDoc ) + throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception) { if( !maAny.hasValue() || !mpFormats->size() || ( maLastFormat != rFlavor.MimeType ) ) { @@ -322,21 +329,21 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th if( SotExchange::GetFormatDataFlavor( FORMAT_STRING, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) ) { - GetData( aSubstFlavor ); + GetData(aSubstFlavor, rDestDoc); bDone = maAny.hasValue(); } else if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) && SotExchange::GetFormatDataFlavor(FORMAT_BITMAP, aSubstFlavor)) { - GetData( aSubstFlavor ); + GetData(aSubstFlavor, rDestDoc); bDone = true; } else if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EMF, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) && SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) ) { - GetData( aSubstFlavor ); + GetData(aSubstFlavor, rDestDoc); if( maAny.hasValue() ) { @@ -366,7 +373,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) && SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) ) { - GetData( aSubstFlavor ); + GetData(aSubstFlavor, rDestDoc); if( maAny.hasValue() ) { @@ -399,7 +406,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th // if any is not yet filled, use standard format if( !maAny.hasValue() ) - GetData( rFlavor ); + GetData(rFlavor, rDestDoc); #ifdef DEBUG if( maAny.hasValue() && ::com::sun::star::uno::TypeClass_STRING != maAny.getValueType().getTypeClass() ) @@ -1537,13 +1544,13 @@ Reference< XTransferable > TransferableDataHelper::GetXTransferable() const -Any TransferableDataHelper::GetAny( SotFormatStringId nFormat ) const +Any TransferableDataHelper::GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const { Any aReturn; DataFlavor aFlavor; if ( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) ) - aReturn = GetAny( aFlavor ); + aReturn = GetAny(aFlavor, rDestDoc); return aReturn; } @@ -1551,7 +1558,7 @@ Any TransferableDataHelper::GetAny( SotFormatStringId nFormat ) const -Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const +Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& rDestDoc ) const { ::osl::MutexGuard aGuard( mpImpl->maMutex ); Any aRet; @@ -1562,13 +1569,20 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const { const SotFormatStringId nRequestFormat = SotExchange::GetFormat( rFlavor ); + Reference<css::datatransfer::XTransferable2> xTransfer2(mxTransfer, UNO_QUERY); + if( nRequestFormat ) { // try to get alien format first for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter) { if( ( nRequestFormat == (*aIter).mnSotId ) && !rFlavor.MimeType.equalsIgnoreAsciiCase( (*aIter).MimeType ) ) - aRet = mxTransfer->getTransferData( *aIter ); + { + if (xTransfer2.is()) + aRet = xTransfer2->getTransferData2(*aIter, rDestDoc); + else + aRet = mxTransfer->getTransferData(*aIter); + } if( aRet.hasValue() ) break; @@ -1576,7 +1590,12 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const } if( !aRet.hasValue() ) - aRet = mxTransfer->getTransferData( rFlavor ); + { + if (xTransfer2.is()) + aRet = xTransfer2->getTransferData2(rFlavor, rDestDoc); + else + aRet = mxTransfer->getTransferData(rFlavor); + } } } catch( const ::com::sun::star::uno::Exception& ) @@ -1598,7 +1617,7 @@ bool TransferableDataHelper::GetString( SotFormatStringId nFormat, OUString& rSt bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, OUString& rStr ) { - Any aAny( GetAny( rFlavor ) ); + Any aAny = GetAny(rFlavor, OUString()); bool bRet = false; if( aAny.hasValue() ) @@ -1969,9 +1988,9 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf case( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ): { - Sequence< sal_Int8 > aSeq; + Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString()); - if( GetSequence( rFlavor, aSeq ) && ( 2048 == aSeq.getLength() ) ) + if (2048 == aSeq.getLength()) { const sal_Char* p1 = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() ); const sal_Char* p2 = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() ) + 1024; @@ -1985,9 +2004,9 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf #ifdef WNT case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: { - Sequence< sal_Int8 > aSeq; + Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString()); - if( GetSequence( rFlavor, aSeq ) && aSeq.getLength() ) + if (aSeq.getLength()) { FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*) aSeq.getConstArray(); @@ -2007,14 +2026,14 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf aSeq.realloc( 0 ); delete pStream; + pStream = NULL; - if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_FILECONTENT, aFileContentFlavor ) && - GetSequence( aFileContentFlavor, aSeq ) && aSeq.getLength() ) + if (SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_FILECONTENT, aFileContentFlavor)) { - pStream = new SvMemoryStream( (sal_Char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_STD_READ ); + aSeq = GetSequence(aFileContentFlavor, OUString()); + if (aSeq.getLength()) + pStream = new SvMemoryStream( (sal_Char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_STD_READ ); } - else - pStream = NULL; } if( pStream ) @@ -2119,22 +2138,27 @@ bool TransferableDataHelper::GetFileList( -bool TransferableDataHelper::GetSequence( SotFormatStringId nFormat, Sequence< sal_Int8 >& rSeq ) +Sequence<sal_Int8> TransferableDataHelper::GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc ) { DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSequence( aFlavor, rSeq ) ); -} - + if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor)) + return Sequence<sal_Int8>(); + return GetSequence(aFlavor, rDestDoc); +} -bool TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, Sequence< sal_Int8 >& rSeq ) +Sequence<sal_Int8> TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, const OUString& rDestDoc ) { #ifdef DEBUG fprintf( stderr, "TransferableDataHelper requests sequence of data\n" ); #endif - const Any aAny( GetAny( rFlavor ) ); - return( aAny.hasValue() && ( aAny >>= rSeq ) ); + const Any aAny = GetAny(rFlavor, rDestDoc); + Sequence<sal_Int8> aSeq; + if (aAny.hasValue()) + aAny >>= aSeq; + + return aSeq; } @@ -2149,40 +2173,38 @@ bool TransferableDataHelper::GetSotStorageStream( SotFormatStringId nFormat, Sot bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, SotStorageStreamRef& rxStream ) { - Sequence< sal_Int8 > aSeq; - bool bRet = GetSequence( rFlavor, aSeq ); + Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString()); - if( bRet ) + if (aSeq.getLength()) { rxStream = new SotStorageStream( "" ); rxStream->Write( aSeq.getConstArray(), aSeq.getLength() ); rxStream->Seek( 0 ); } - return bRet; + return aSeq.getLength(); } -bool TransferableDataHelper::GetInputStream( SotFormatStringId nFormat, Reference < XInputStream >& rxStream ) +Reference<XInputStream> TransferableDataHelper::GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc ) { DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetInputStream( aFlavor, rxStream ) ); -} - + if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor)) + return Reference<XInputStream>(); + return GetInputStream(aFlavor, rDestDoc); +} -bool TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, Reference < XInputStream >& rxStream ) +Reference<XInputStream> TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, const OUString& rDestDoc ) { - Sequence< sal_Int8 > aSeq; - bool bRet = GetSequence( rFlavor, aSeq ); + Sequence<sal_Int8> aSeq = GetSequence(rFlavor, rDestDoc); - if( bRet ) - rxStream = new ::comphelper::SequenceInputStream( aSeq ); + if (!aSeq.getLength()) + return Reference<XInputStream>(); - return bRet; + Reference<XInputStream> xStream(new comphelper::SequenceInputStream(aSeq)); + return xStream; } - - void TransferableDataHelper::Rebind( const Reference< XTransferable >& _rxNewContent ) { mxTransfer = _rxNewContent; diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 541571fdea97..c79ddbf8bfc9 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -415,8 +415,8 @@ void TransferDataContainer::AddSupportedFormats() -bool TransferDataContainer::GetData( const - ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool TransferDataContainer::GetData( + const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { TDataCntnrEntryList::iterator aIter( pImpl->aFmtList.begin() ), aEnd( pImpl->aFmtList.end() ); diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 9659771a960a..3ac2c0d6a49f 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -441,7 +441,9 @@ SdrModel* E3dView::GetMarkedObjModel() const // When pasting objects have to integrated if a scene is inserted, but // not the scene itself -bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) +bool E3dView::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { bool bRetval = false; @@ -486,7 +488,7 @@ bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, s else { // call parent - bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions); + bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID); } return bRetval; diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index fd639185e4c9..4cd42174270f 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -224,7 +224,7 @@ namespace svx } - bool OColumnTransferable::GetData( const DataFlavor& _rFlavor ) + bool OColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); switch (nFormatId) @@ -276,7 +276,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; @@ -469,7 +469,7 @@ namespace svx } - bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor ) + bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uIntPtr nFormat = SotExchange::GetFormat(rFlavor); switch (nFormat) @@ -524,7 +524,7 @@ namespace svx SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; @@ -644,7 +644,7 @@ namespace svx AddFormat(getDescriptorFormatId()); } - bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor ) + bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); if (nFormatId == getDescriptorFormatId()) @@ -682,7 +682,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - _rData.GetAny(aFlavor) >>= aList; + _rData.GetAny(aFlavor, OUString()) >>= aList; } // if (_rData.HasFormat(getDescriptorFormatId())) return aList; } diff --git a/svx/source/fmcomp/dbaobjectex.cxx b/svx/source/fmcomp/dbaobjectex.cxx index b64beae98f72..c994db3426db 100644 --- a/svx/source/fmcomp/dbaobjectex.cxx +++ b/svx/source/fmcomp/dbaobjectex.cxx @@ -90,7 +90,7 @@ namespace svx } - bool OComponentTransferable::GetData( const DataFlavor& _rFlavor ) + bool OComponentTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); if ( nFormatId == getDescriptorFormatId(true) || nFormatId == getDescriptorFormatId(false) ) @@ -131,7 +131,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(bForm), aFlavor); OSL_ENSURE(bSuccess, "OComponentTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; diff --git a/svx/source/fmcomp/xmlexchg.cxx b/svx/source/fmcomp/xmlexchg.cxx index b02ea58f3e99..058d36d85d81 100644 --- a/svx/source/fmcomp/xmlexchg.cxx +++ b/svx/source/fmcomp/xmlexchg.cxx @@ -43,7 +43,7 @@ namespace svx AddFormat( SOT_FORMATSTR_ID_XFORMS ); } - bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor ) + bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor ); if ( SOT_FORMATSTR_ID_XFORMS == nFormatId ) diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx index 48d5838b8286..b224432d8e86 100644 --- a/svx/source/form/fmexch.cxx +++ b/svx/source/form/fmexch.cxx @@ -115,7 +115,7 @@ namespace svxform } - bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/ ) + bool OLocalExchange::GetData( const css::datatransfer::DataFlavor& /*_rFlavor*/, const OUString& /*rDestDoc*/ ) { return false; // do not have any formats by default } @@ -139,7 +139,7 @@ namespace svxform if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) ) { // paths to the controls, relative to a root Sequence< Any > aControlPathData; - if ( aExchangedData.GetAny( OControlExchange::getControlPathFormatId() ) >>= aControlPathData ) + if ( aExchangedData.GetAny(OControlExchange::getControlPathFormatId(), OUString()) >>= aControlPathData ) { DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" ); if ( aControlPathData.getLength() >= 2 ) @@ -155,7 +155,7 @@ namespace svxform } if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) ) { // sequence of models of hidden controls - aExchangedData.GetAny( OControlExchange::getHiddenControlModelsFormatId() ) >>= m_aHiddenControlModels; + aExchangedData.GetAny(OControlExchange::getHiddenControlModelsFormatId(), OUString()) >>= m_aHiddenControlModels; } updateFormats( ); @@ -290,7 +290,7 @@ namespace svxform } - bool OControlExchange::GetData( const DataFlavor& _rFlavor ) + bool OControlExchange::GetData( const DataFlavor& _rFlavor, const OUString& rDestDoc ) { const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor ); @@ -310,7 +310,7 @@ namespace svxform SetAny( makeAny( m_aHiddenControlModels ), _rFlavor ); } else - return OLocalExchange::GetData( _rFlavor ); + return OLocalExchange::GetData(_rFlavor, rDestDoc); return true; } diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index e6234e2c942c..702fd00ef0c1 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -379,13 +379,6 @@ SdrModel* FmFormView::GetMarkedObjModel() const return E3dView::GetMarkedObjModel(); } - -bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) -{ - return E3dView::Paste(rMod, rPos, pLst, nOptions); -} - - void FmFormView::ActivateControls(SdrPageView* pPageView) { if (!pPageView) diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index e89658761cdd..47b05eabaccd 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -507,7 +507,7 @@ void GalleryTransferable::AddSupportedFormats() } } -bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor ) +bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); bool bRet = false; diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx index 8e47403aa43e..dbdc4f3c5140 100644 --- a/svx/source/inc/fmexch.hxx +++ b/svx/source/inc/fmexch.hxx @@ -82,7 +82,7 @@ namespace svxform // TransferableHelper virtual void DragFinished( sal_Int8 nDropAction ) 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; private: void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions, sal_Int32 nDragPointer = DND_POINTER_NONE, sal_Int32 nDragImage = DND_IMAGE_NONE ) @@ -225,7 +225,7 @@ namespace svxform inline static bool hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ); protected: - 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 void AddSupportedFormats() SAL_OVERRIDE; }; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index d8513d51d136..a5fd48ae757d 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1041,6 +1041,11 @@ SdrObject* SdrObject::Clone() const return CloneHelper< SdrObject >(); } +SdrObject* SdrObject::CloneWithShellIDs( const OUString& /*rSrcShellID*/, const OUString& /*rDestShellID*/ ) const +{ + return Clone(); +} + SdrObject& SdrObject::operator=(const SdrObject& rObj) { if( this == &rObj ) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index e01dae90f35a..86379ce7f8fd 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1624,7 +1624,20 @@ SdrOle2Obj* SdrOle2Obj::Clone() const return CloneHelper< SdrOle2Obj >(); } -SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) +SdrOle2Obj* SdrOle2Obj::CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const +{ + SdrOle2Obj* pObj = + dynamic_cast<SdrOle2Obj*>( + SdrObjFactory::MakeNewObject(GetObjInventor(), GetObjIdentifier(), NULL)); + + if (pObj) + pObj->assignFrom(*this, rSrcShellID, rDestShellID); + + return pObj; +} + +SdrOle2Obj& SdrOle2Obj::assignFrom( + const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID ) { //TODO/LATER: who takes over control of my old object?! if( &rObj != this ) @@ -1671,7 +1684,8 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) if ( xObj.is() ) { OUString aTmp; - xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() ); + xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( + rContainer, xObj, aTmp, rSrcShellID, rDestShellID), rOle2Obj.GetAspect()); m_bTypeAsked = false; mpImpl->aPersistName = aTmp; CheckFileLink_Impl(); @@ -1684,7 +1698,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) return *this; } - +SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) +{ + return assignFrom(rObj, OUString(), OUString()); +} void SdrOle2Obj::ImpSetVisAreaSize() { diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 0ec6046e8584..5b3c57b14944 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -223,7 +223,9 @@ bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt return true; } -bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) +bool SdrExchangeView::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { const SdrModel* pSrcMod=&rMod; if (pSrcMod==pMod) @@ -298,7 +300,7 @@ bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* { const SdrObject* pSrcOb=pSrcPg->GetObj(nOb); - SdrObject* pNeuObj = pSrcOb->Clone(); + SdrObject* pNeuObj = pSrcOb->CloneWithShellIDs(rSrcShellID, rDestShellID); if (pNeuObj!=NULL) { diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 28809d41c303..5209fa9bfca2 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -49,7 +49,7 @@ private: protected: 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; public: @@ -67,7 +67,7 @@ void SvxColorValueSetData::AddSupportedFormats() -bool SvxColorValueSetData::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool SvxColorValueSetData::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { bool bRet = false; diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 9aaab2aa8729..2dfa6a9c08ad 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1507,7 +1507,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) // #i50824# // method <lcl_RemoveOleObjsFromSdrModel> replaced by <lcl_ConvertSdrOle2ObjsToSdrGrafObjs> lcl_ConvertSdrOle2ObjsToSdrGrafObjs( pModel ); - pView->Paste( *pModel, aPos ); + pView->Paste(*pModel, aPos, NULL, 0, OUString(), OUString()); sal_uLong nCnt = pView->GetMarkedObjectList().GetMarkCount(); if( nCnt ) diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 188d0124da1d..7c47e26d7887 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -435,7 +435,9 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const pPersistShell->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject( pSrc->GetEmbeddedObjectContainer(), pSrc->GetEmbeddedObjectContainer().GetEmbeddedObject( aOLEObj.aName ), - aNewName ); + aNewName, + OUString(), + OUString()); SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(), (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl(), diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index fbb75a958d7f..10c1b7ee1329 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -435,7 +435,7 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) // TODO/LATER: Copying through the container would copy the replacement image as well comphelper::EmbeddedObjectContainer aCnt; OUString aName = aCnt.CreateUniqueObjectName(); - if ( aCnt.StoreEmbeddedObject( rSwOLE.GetOleRef(), aName, true ) ) + if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString())) { uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName ); rDoc.Insert( rContext.GetRepeatPaM(), diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 13cf00612798..9d33a7068e09 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -396,7 +396,7 @@ namespace } } -bool SwTransferable::GetData( const DataFlavor& rFlavor ) +bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); @@ -492,7 +492,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor ) if( xObj.is() ) { TransferableDataHelper aD( new SvEmbedTransferHelper( xObj, pOLEGraph, nAspect ) ); - uno::Any aAny( aD.GetAny( rFlavor )); + uno::Any aAny = aD.GetAny(rFlavor, rDestDoc); if( aAny.hasValue() ) bOK = SetAny( aAny, rFlavor ); } @@ -1716,7 +1716,13 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, else nId = 0; - if( nId && rData.GetInputStream( nId, xStrm ) && xStrm.is() ) + if (nId) + { + SwDocShell* pDocSh = rSh.GetDoc()->GetDocShell(); + xStrm = rData.GetInputStream(nId, SfxObjectShell::CreateShellID(pDocSh)); + } + + if (xStrm.is()) { // if there is an embedded object, first try if it's a writer object // this will be inserted into the document by using a Reader @@ -1783,8 +1789,9 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFmt, aObjDesc ) ) { - if ( !rData.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStrm ) ) - rData.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStrm ); + xStrm = rData.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString()); + if (!xStrm.is()) + xStrm = rData.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString()); if ( !xStrm.is() ) { diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index c5d3b6e6a6ec..de20e748dca0 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -137,7 +137,7 @@ class SW_DLLPUBLIC SwTransferable : public TransferableHelper protected: virtual void AddSupportedFormats() SAL_OVERRIDE; - virtual bool GetData( const css::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, diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 5691a5b9ce75..5bda8cc55707 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -154,7 +154,7 @@ public: com::sun::star::chart::XChartDocument > rChartDoc, bool bIncludeTable ); - UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return mxPropertySetMapper;} + UniReference<XMLPropertySetMapper> GetPropertySetMapper() const; void SetChartRangeAddress( const OUString& rAddress ) { msChartAddress = rAddress; } @@ -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,20 @@ 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; +} void SchXMLExportHelper_Impl::exportAutoStyles() { @@ -2262,6 +2279,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( @@ -2282,6 +2325,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; @@ -3558,6 +3609,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 ); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 2086d2a7b5b2..5e6571319d18 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -259,6 +259,9 @@ public: /// name of stream in package, e.g., "content.xml" OUString mStreamName; + OUString maSrcShellID; + OUString maDestShellID; + /// stack of backed up namespace maps /// long: depth at which namespace map has been backed up into the stack ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps; @@ -797,15 +800,16 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue try { + const sal_Int32 nPropCount = aDescriptor.getLength(); + const sal_uInt32 nTest = EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS; if( (mnExportFlags & nTest) == nTest && msOrigFileName.isEmpty() ) { // evaluate descriptor only for flat files and if a base URI // has not been provided already - const sal_Int32 nPropCount = aDescriptor.getLength(); - const beans::PropertyValue* pProps = aDescriptor.getConstArray(); + const beans::PropertyValue* pProps = aDescriptor.getConstArray(); for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ ) { const OUString& rPropName = pProps->Name; @@ -824,6 +828,25 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue } } + const beans::PropertyValue* pProps = aDescriptor.getConstArray(); + for (sal_Int32 nIndex = 0; nIndex < nPropCount; ++nIndex, ++pProps) + { + const OUString& rPropName = pProps->Name; + const Any& rValue = pProps->Value; + + if (rPropName == "SourceShellID") + { + if (!(rValue >>= mpImpl->maSrcShellID)) + return false; + } + else if (rPropName == "DestinationShellID") + { + if (!(rValue >>= mpImpl->maDestShellID)) + return false; + } + } + + exportDoc( meClass ); } catch(const uno::Exception& e) @@ -1510,6 +1533,16 @@ void SvXMLExport::ResetNamespaceMap() delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap; } +OUString SvXMLExport::GetSourceShellID() const +{ + return mpImpl->maSrcShellID; +} + +OUString SvXMLExport::GetDestinationShellID() const +{ + return mpImpl->maDestShellID; +} + void SvXMLExport::_ExportMeta() { OUString generator( ::utl::DocInfoHelper::GetGeneratorString() ); |