Blame SOURCES/0022-fdo-71076-fdo-71767-Preserve-number-formats-when-cha.patch

f085be
From 388f2fa9fcabe1b2adaff282fa9509216f3af6de Mon Sep 17 00:00:00 2001
f085be
From: Kohei Yoshida <kohei.yoshida@collabora.com>
f085be
Date: Fri, 13 Jun 2014 11:12:50 -0400
f085be
Subject: [PATCH 022/137] fdo#71076, fdo#71767: Preserve number formats when
f085be
 charts are copied.
f085be
f085be
(cherry picked from commit 1d38cb365543924f9c50014e6b2227e77de1d0c9)
f085be
Signed-off-by: Andras Timar <andras.timar@collabora.com>
f085be
f085be
Conflicts:
f085be
	xmloff/source/chart/SchXMLExport.cxx
f085be
	sd/source/ui/view/sdview3.cxx
f085be
	chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
f085be
	chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
f085be
	chart2/source/controller/main/ChartTransferable.cxx
f085be
	chart2/source/controller/main/ChartTransferable.hxx
f085be
	chart2/source/model/main/Axis.cxx
f085be
	chart2/source/model/template/ChartTypeTemplate.cxx
f085be
	chart2/source/tools/AxisHelper.cxx
f085be
	chart2/source/view/main/ChartView.cxx
f085be
	comphelper/source/container/embeddedobjectcontainer.cxx
f085be
	dbaccess/source/ui/browser/dbexchange.cxx
f085be
	dbaccess/source/ui/inc/JoinExchange.hxx
f085be
	dbaccess/source/ui/inc/TableRowExchange.hxx
f085be
	dbaccess/source/ui/inc/dbexchange.hxx
f085be
	dbaccess/source/ui/querydesign/JoinExchange.cxx
f085be
	dbaccess/source/ui/tabledesign/TableRowExchange.cxx
f085be
	embeddedobj/source/commonembedding/persistence.cxx
f085be
	embeddedobj/source/inc/commonembobj.hxx
f085be
	include/comphelper/embeddedobjectcontainer.hxx
f085be
	include/svtools/embedtransfer.hxx
f085be
	include/svtools/stringtransfer.hxx
f085be
	include/svtools/transfer.hxx
f085be
	include/svx/dbaexchange.hxx
f085be
	include/svx/dbaobjectex.hxx
f085be
	include/svx/fmview.hxx
f085be
	include/svx/galmisc.hxx
f085be
	include/svx/svdobj.hxx
f085be
	include/svx/svdoole2.hxx
f085be
	include/svx/svdxcgv.hxx
f085be
	include/svx/view3d.hxx
f085be
	include/svx/xmlexchg.hxx
f085be
	include/xmloff/xmlexp.hxx
f085be
	reportdesign/source/ui/dlg/GroupExchange.cxx
f085be
	reportdesign/source/ui/dlg/GroupExchange.hxx
f085be
	reportdesign/source/ui/inc/dlgedclip.hxx
f085be
	reportdesign/source/ui/report/dlgedclip.cxx
f085be
	sc/inc/column.hxx
f085be
	sc/source/ui/app/drwtrans.cxx
f085be
	sc/source/ui/app/lnktrans.cxx
f085be
	sc/source/ui/app/seltrans.cxx
f085be
	sc/source/ui/app/transobj.cxx
f085be
	sc/source/ui/inc/drwtrans.hxx
f085be
	sc/source/ui/inc/lnktrans.hxx
f085be
	sc/source/ui/inc/seltrans.hxx
f085be
	sc/source/ui/inc/transobj.hxx
f085be
	sc/source/ui/inc/viewfunc.hxx
f085be
	sc/source/ui/view/viewfun5.cxx
f085be
	sc/source/ui/view/viewfun7.cxx
f085be
	sd/source/ui/app/sdxfer.cxx
f085be
	sd/source/ui/dlg/sdtreelb.cxx
f085be
	sd/source/ui/inc/TabControl.hxx
f085be
	sd/source/ui/inc/View.hxx
f085be
	sd/source/ui/inc/sdtreelb.hxx
f085be
	sd/source/ui/inc/sdxfer.hxx
f085be
	sd/source/ui/view/sdview2.cxx
f085be
	sd/source/ui/view/tabcontr.cxx
f085be
	sfx2/source/doc/objxtor.cxx
f085be
	svtools/source/misc/embedtransfer.cxx
f085be
	svtools/source/misc/stringtransfer.cxx
f085be
	svtools/source/misc/transfer.cxx
f085be
	svtools/source/misc/transfer2.cxx
f085be
	svx/source/engine3d/view3d.cxx
f085be
	svx/source/fmcomp/dbaexchange.cxx
f085be
	svx/source/fmcomp/dbaobjectex.cxx
f085be
	svx/source/fmcomp/xmlexchg.cxx
f085be
	svx/source/form/fmexch.cxx
f085be
	svx/source/form/fmview.cxx
f085be
	svx/source/gallery2/galmisc.cxx
f085be
	svx/source/inc/fmexch.hxx
f085be
	svx/source/svdraw/svdoole2.cxx
f085be
	svx/source/svdraw/svdxcgv.cxx
f085be
	svx/source/tbxctrls/colrctrl.cxx
f085be
	sw/source/core/uibase/dochdl/swdtflvr.cxx
f085be
	sw/source/core/uibase/inc/swdtflvr.hxx
f085be
	sw/source/core/undo/unins.cxx
f085be
f085be
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
f085be
(cherry picked from commit 4ee53683df4beda260aff26d2c9e56fe643f45bb)
f085be
Signed-off-by: Andras Timar <andras.timar@collabora.com>
f085be
---
f085be
 .../controller/chartapiwrapper/AxisWrapper.cxx     |   5 +-
f085be
 .../chartapiwrapper/DataSeriesPointWrapper.cxx     |   5 +-
f085be
 .../WrappedNumberFormatProperty.cxx                |  66 ++---------
f085be
 .../WrappedNumberFormatProperty.hxx                |   9 +-
f085be
 .../itemsetwrapper/AxisItemConverter.cxx           |   9 +-
f085be
 .../controller/main/ChartDropTargetHelper.cxx      |   4 +-
f085be
 .../source/controller/main/ChartTransferable.cxx   |   2 +-
f085be
 .../source/controller/main/ChartTransferable.hxx   |   2 +-
f085be
 chart2/source/model/filter/XMLFilter.cxx           |   5 +-
f085be
 chart2/source/model/inc/XMLFilter.hxx              |   3 +
f085be
 chart2/source/model/main/Axis.cxx                  |  17 ++-
f085be
 chart2/source/model/main/DataPointProperties.cxx   |  11 +-
f085be
 chart2/source/model/main/DataPointProperties.hxx   |   1 +
f085be
 chart2/source/model/template/ChartTypeTemplate.cxx |  10 +-
f085be
 chart2/source/tools/AxisHelper.cxx                 |  15 ++-
f085be
 chart2/source/view/main/ChartView.cxx              |  18 ++-
f085be
 .../source/container/embeddedobjectcontainer.cxx   |  23 +++-
f085be
 dbaccess/source/ui/browser/dbexchange.cxx          |   4 +-
f085be
 dbaccess/source/ui/inc/JoinExchange.hxx            |   2 +-
f085be
 dbaccess/source/ui/inc/TableRowExchange.hxx        |   2 +-
f085be
 dbaccess/source/ui/inc/dbexchange.hxx              |   2 +-
f085be
 dbaccess/source/ui/querydesign/JoinExchange.cxx    |   2 +-
f085be
 .../source/ui/tabledesign/TableRowExchange.cxx     |   2 +-
f085be
 embeddedobj/source/commonembedding/persistence.cxx |  54 +++++++--
f085be
 embeddedobj/source/inc/commonembobj.hxx            |  12 +-
f085be
 include/comphelper/embeddedobjectcontainer.hxx     |   8 +-
f085be
 include/sfx2/objsh.hxx                             |   2 +
f085be
 include/svtools/embedtransfer.hxx                  |   6 +-
f085be
 include/svtools/stringtransfer.hxx                 |   2 +-
f085be
 include/svtools/transfer.hxx                       |  31 +++---
f085be
 include/svx/dbaexchange.hxx                        |   6 +-
f085be
 include/svx/dbaobjectex.hxx                        |   2 +-
f085be
 include/svx/fmview.hxx                             |   2 -
f085be
 include/svx/galmisc.hxx                            |   2 +-
f085be
 include/svx/svdobj.hxx                             |   7 +-
f085be
 include/svx/svdoole2.hxx                           |   3 +
f085be
 include/svx/svdxcgv.hxx                            |   5 +-
f085be
 include/svx/view3d.hxx                             |   4 +-
f085be
 include/svx/xmlexchg.hxx                           |   2 +-
f085be
 include/xmloff/SchXMLExportHelper.hxx              |   3 +
f085be
 include/xmloff/xmlexp.hxx                          |   3 +
f085be
 offapi/UnoApi_offapi.mk                            |   1 +
f085be
 .../com/sun/star/datatransfer/XTransferable2.idl   |  41 +++++++
f085be
 reportdesign/source/ui/dlg/GroupExchange.cxx       |   4 +-
f085be
 reportdesign/source/ui/dlg/GroupExchange.hxx       |   2 +-
f085be
 reportdesign/source/ui/dlg/GroupsSorting.cxx       |   4 +-
f085be
 reportdesign/source/ui/inc/dlgedclip.hxx           |   2 +-
f085be
 reportdesign/source/ui/report/dlgedclip.cxx        |   8 +-
f085be
 sc/inc/column.hxx                                  |   6 +-
f085be
 sc/inc/document.hxx                                |   1 +
f085be
 sc/inc/table.hxx                                   |   6 +-
f085be
 sc/source/core/data/column.cxx                     |  14 ++-
f085be
 sc/source/core/data/document.cxx                   |   6 +-
f085be
 sc/source/core/data/table2.cxx                     |   5 +-
f085be
 sc/source/ui/app/drwtrans.cxx                      |  54 ++++++---
f085be
 sc/source/ui/app/lnktrans.cxx                      |   3 +-
f085be
 sc/source/ui/app/seltrans.cxx                      |   5 +-
f085be
 sc/source/ui/app/transobj.cxx                      |   2 +-
f085be
 sc/source/ui/inc/drwtrans.hxx                      |   7 +-
f085be
 sc/source/ui/inc/lnktrans.hxx                      |   2 +-
f085be
 sc/source/ui/inc/seltrans.hxx                      |   2 +-
f085be
 sc/source/ui/inc/transobj.hxx                      |   2 +-
f085be
 sc/source/ui/inc/viewfunc.hxx                      |   4 +-
f085be
 sc/source/ui/view/gridwin.cxx                      |   8 +-
f085be
 sc/source/ui/view/viewfun3.cxx                     |  11 +-
f085be
 sc/source/ui/view/viewfun5.cxx                     |  22 ++--
f085be
 sc/source/ui/view/viewfun7.cxx                     |   6 +-
f085be
 sd/source/core/drawdoc3.cxx                        |   2 +-
f085be
 sd/source/ui/app/sdxfer.cxx                        |   4 +-
f085be
 sd/source/ui/dlg/sdtreelb.cxx                      |   3 +-
f085be
 sd/source/ui/inc/TabControl.hxx                    |   2 +-
f085be
 sd/source/ui/inc/View.hxx                          |   4 +-
f085be
 sd/source/ui/inc/sdtreelb.hxx                      |   2 +-
f085be
 sd/source/ui/inc/sdxfer.hxx                        |   2 +-
f085be
 sd/source/ui/view/sdview2.cxx                      |   6 +-
f085be
 sd/source/ui/view/sdview3.cxx                      |  29 +++--
f085be
 sd/source/ui/view/tabcontr.cxx                     |   2 +-
f085be
 sfx2/source/doc/objxtor.cxx                        |  19 +++-
f085be
 starmath/source/view.cxx                           |   6 +-
f085be
 svtools/source/contnr/treelistbox.cxx              |   5 +-
f085be
 svtools/source/dialogs/insdlg.cxx                  |   2 +-
f085be
 svtools/source/misc/embedtransfer.cxx              |  15 ++-
f085be
 svtools/source/misc/stringtransfer.cxx             |   3 +-
f085be
 svtools/source/misc/transfer.cxx                   | 121 ++++++++++++---------
f085be
 svtools/source/misc/transfer2.cxx                  |   4 +-
f085be
 svx/source/engine3d/view3d.cxx                     |   6 +-
f085be
 svx/source/fmcomp/dbaexchange.cxx                  |  16 ++-
f085be
 svx/source/fmcomp/dbaobjectex.cxx                  |   5 +-
f085be
 svx/source/fmcomp/xmlexchg.cxx                     |   2 +-
f085be
 svx/source/form/fmexch.cxx                         |  11 +-
f085be
 svx/source/form/fmview.cxx                         |   7 --
f085be
 svx/source/gallery2/galmisc.cxx                    |   2 +-
f085be
 svx/source/inc/fmexch.hxx                          |   4 +-
f085be
 svx/source/svdraw/svdobj.cxx                       |   5 +
f085be
 svx/source/svdraw/svdoole2.cxx                     |  23 +++-
f085be
 svx/source/svdraw/svdxcgv.cxx                      |   6 +-
f085be
 svx/source/tbxctrls/colrctrl.cxx                   |   4 +-
f085be
 sw/source/core/frmedt/fecopy.cxx                   |   2 +-
f085be
 sw/source/core/ole/ndole.cxx                       |   4 +-
f085be
 sw/source/core/undo/unins.cxx                      |   2 +-
f085be
 sw/source/ui/dochdl/swdtflvr.cxx                   |  17 ++-
f085be
 sw/source/ui/inc/swdtflvr.hxx                      |   2 +-
f085be
 xmloff/source/chart/SchXMLExport.cxx               |  50 +++++++++
f085be
 xmloff/source/core/xmlexp.cxx                      |  37 ++++++-
f085be
 104 files changed, 687 insertions(+), 350 deletions(-)
f085be
 create mode 100644 offapi/com/sun/star/datatransfer/XTransferable2.idl
f085be
f085be
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
f085be
index 665ea53..28226dc 100644
f085be
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
f085be
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
f085be
@@ -637,9 +637,8 @@ const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties()
f085be
     aWrappedProperties.push_back( new WrappedProperty("Visible","Show") );
f085be
     aWrappedProperties.push_back( new WrappedDirectStateProperty("DisplayLabels","DisplayLabels") );
f085be
     aWrappedProperties.push_back( new WrappedDirectStateProperty("TextBreak","TextBreak") );
f085be
-    WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
f085be
-    aWrappedProperties.push_back( pWrappedNumberFormatProperty );
f085be
-    aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
f085be
+    aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) );
f085be
+    aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
f085be
     aWrappedProperties.push_back( new WrappedProperty("StackedText","StackCharacters") );
f085be
     aWrappedProperties.push_back( new WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") );
f085be
     {
f085be
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
f085be
index 9b5b622..a507782 100644
f085be
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
f085be
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
f085be
@@ -698,9 +698,8 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
f085be
         WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
f085be
         aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
f085be
 
f085be
-        WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
f085be
-        aWrappedProperties.push_back( pWrappedNumberFormatProperty );
f085be
-        aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
f085be
+        aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) );
f085be
+        aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
f085be
     }
f085be
 
f085be
     WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
f085be
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
f085be
index a4010a8..5370d117 100644
f085be
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
f085be
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
f085be
@@ -33,16 +33,10 @@ WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< C
f085be
         : WrappedDirectStateProperty( "NumberFormat", "NumberFormat" )
f085be
         , m_spChart2ModelContact(spChart2ModelContact)
f085be
 {
f085be
-    m_aOuterValue = getPropertyDefault( 0 );
f085be
 }
f085be
 
f085be
 WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
f085be
 {
f085be
-    if( m_pWrappedLinkNumberFormatProperty )
f085be
-    {
f085be
-        if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty == this )
f085be
-            m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty = 0;
f085be
-    }
f085be
 }
f085be
 
f085be
 void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
f085be
@@ -52,19 +46,8 @@ void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, cons
f085be
     if( ! (rOuterValue >>= nFormat) )
f085be
         throw lang::IllegalArgumentException( "Property 'NumberFormat' requires value of type sal_Int32", 0, 0 );
f085be
 
f085be
-    m_aOuterValue = rOuterValue;
f085be
     if(xInnerPropertySet.is())
f085be
-    {
f085be
-        bool bUseSourceFormat = !xInnerPropertySet->getPropertyValue( "NumberFormat" ).hasValue();
f085be
-        if( bUseSourceFormat )
f085be
-        {
f085be
-            uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
f085be
-            if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
f085be
-                bUseSourceFormat = false;
f085be
-        }
f085be
-        if( !bUseSourceFormat )
f085be
-            xInnerPropertySet->setPropertyValue( m_aInnerName, this->convertOuterToInnerValue( rOuterValue ) );
f085be
-    }
f085be
+        xInnerPropertySet->setPropertyValue(getInnerName(), this->convertOuterToInnerValue(rOuterValue));
f085be
 }
f085be
 
f085be
 Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
f085be
@@ -75,7 +58,7 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp
f085be
         OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
f085be
         return Any();
f085be
     }
f085be
-    Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
f085be
+    Any aRet( xInnerPropertySet->getPropertyValue(getInnerName()));
f085be
     if( !aRet.hasValue() )
f085be
     {
f085be
         sal_Int32 nKey = 0;
f085be
@@ -98,23 +81,14 @@ Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPr
f085be
     return uno::makeAny( sal_Int32( 0 ) );
f085be
 }
f085be
 
f085be
-WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty )
f085be
-    : WrappedProperty( "LinkNumberFormatToSource", OUString() )
f085be
-        , m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty )
f085be
+WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) :
f085be
+    WrappedDirectStateProperty("LinkNumberFormatToSource", "LinkNumberFormatToSource"),
f085be
+    m_pChart2ModelContact(pChart2ModelContact)
f085be
 {
f085be
-    if( m_pWrappedNumberFormatProperty )
f085be
-    {
f085be
-        m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = this;
f085be
-    }
f085be
 }
f085be
 
f085be
 WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
f085be
 {
f085be
-    if( m_pWrappedNumberFormatProperty )
f085be
-    {
f085be
-        if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty == this )
f085be
-            m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 0;
f085be
-    }
f085be
 }
f085be
 
f085be
 void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
f085be
@@ -126,31 +100,7 @@ void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue,
f085be
         return;
f085be
     }
f085be
 
f085be
-    bool bLinkFormat = false;
f085be
-    if( rOuterValue >>= bLinkFormat )
f085be
-    {
f085be
-        Any aValue;
f085be
-        if( bLinkFormat )
f085be
-        {
f085be
-            if( m_pWrappedNumberFormatProperty )
f085be
-            {
f085be
-                uno::Reference< chart2::XChartDocument > xChartDoc( m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() );
f085be
-                if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
f085be
-                    return;
f085be
-            }
f085be
-        }
f085be
-        else
f085be
-        {
f085be
-            if( m_pWrappedNumberFormatProperty )
f085be
-            {
f085be
-                aValue = m_pWrappedNumberFormatProperty->getPropertyValue( xInnerPropertySet );
f085be
-            }
f085be
-            else
f085be
-                aValue <<= sal_Int32( 0 );
f085be
-        }
f085be
-
f085be
-        xInnerPropertySet->setPropertyValue( "NumberFormat", aValue );
f085be
-    }
f085be
+    xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue);
f085be
 }
f085be
 
f085be
 Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
f085be
@@ -161,8 +111,8 @@ Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::X
f085be
         OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
f085be
         return getPropertyDefault(0);
f085be
     }
f085be
-    bool bLink = ! xInnerPropertySet->getPropertyValue( "NumberFormat" ).hasValue();
f085be
-    return uno::makeAny( bLink );
f085be
+
f085be
+    return xInnerPropertySet->getPropertyValue(getInnerName());
f085be
 }
f085be
 
f085be
 Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
f085be
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
f085be
index 63a562c..9602080 100644
f085be
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
f085be
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
f085be
@@ -49,14 +49,12 @@ public:
f085be
     friend class WrappedLinkNumberFormatProperty;
f085be
 private:
f085be
     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
f085be
-    mutable ::com::sun::star::uno::Any m_aOuterValue;
f085be
-    WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty;
f085be
 };
f085be
 
f085be
-class WrappedLinkNumberFormatProperty : public WrappedProperty
f085be
+class WrappedLinkNumberFormatProperty : public WrappedDirectStateProperty
f085be
 {
f085be
 public:
f085be
-    WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty );
f085be
+    WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact );
f085be
     virtual ~WrappedLinkNumberFormatProperty();
f085be
 
f085be
     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
f085be
@@ -68,9 +66,8 @@ public:
f085be
     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
f085be
                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
f085be
 
f085be
-    friend class WrappedNumberFormatProperty;
f085be
 private:
f085be
-    WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty;
f085be
+    boost::shared_ptr<Chart2ModelContact> m_pChart2ModelContact;
f085be
 };
f085be
 
f085be
 } //namespace wrapper
f085be
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
f085be
index 328dd8c..7974dc1 100644
f085be
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
f085be
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
f085be
@@ -425,8 +425,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
f085be
 
f085be
         case SID_ATTR_NUMBERFORMAT_SOURCE:
f085be
         {
f085be
-            bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( "NumberFormat" ).hasValue());
f085be
-            rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
f085be
+            bool bLinkToSource = true;
f085be
+            GetPropertySet()->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource;
f085be
+            rOutItemSet.Put(SfxBoolItem(nWhichId, bLinkToSource));
f085be
         }
f085be
         break;
f085be
 
f085be
@@ -932,7 +933,9 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
f085be
             bool bUseSourceFormat =
f085be
                 (static_cast< const SfxBoolItem & >(
f085be
                     rItemSet.Get( nWhichId )).GetValue() );
f085be
-            bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( "NumberFormat").hasValue());
f085be
+            GetPropertySet()->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(bUseSourceFormat));
f085be
+
f085be
+            bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue("NumberFormat").hasValue();
f085be
 
f085be
             bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
f085be
             if( bChangedOtherwise )
f085be
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx
f085be
index 154db84..0857de3 100644
f085be
--- a/chart2/source/controller/main/ChartDropTargetHelper.cxx
f085be
+++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx
f085be
@@ -103,8 +103,8 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
f085be
         TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
f085be
         if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK ))
f085be
         {
f085be
-            Sequence< sal_Int8 > aBytes;
f085be
-            if( aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aBytes ))
f085be
+            Sequence<sal_Int8> aBytes = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString());
f085be
+            if (aBytes.getLength())
f085be
             {
f085be
                 ::std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes ));
f085be
                 if( aStrings.size() >= 3 && aStrings[0] == "soffice" )
f085be
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
f085be
index f072b21..e7d7d2b 100644
f085be
--- a/chart2/source/controller/main/ChartTransferable.cxx
f085be
+++ b/chart2/source/controller/main/ChartTransferable.cxx
f085be
@@ -75,7 +75,7 @@ void ChartTransferable::AddSupportedFormats()
f085be
     AddFormat( SOT_FORMAT_BITMAP );
f085be
 }
f085be
 
f085be
-sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
f085be
     sal_Bool    bResult = sal_False;
f085be
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
f085be
index efbd1b3..9ae5aaf 100644
f085be
--- a/chart2/source/controller/main/ChartTransferable.hxx
f085be
+++ b/chart2/source/controller/main/ChartTransferable.hxx
f085be
@@ -43,7 +43,7 @@ protected:
f085be
 
f085be
     // implementation of TransferableHelper methods
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
f085be
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
 
f085be
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
f085be
index cee36fa..ce44fd7 100644
f085be
--- a/chart2/source/model/filter/XMLFilter.cxx
f085be
+++ b/chart2/source/model/filter/XMLFilter.cxx
f085be
@@ -548,6 +548,7 @@ sal_Int32 XMLFilter::impl_Export(
f085be
     const Reference< lang::XComponent > & xDocumentComp,
f085be
     const Sequence< beans::PropertyValue > & rMediaDescriptor )
f085be
 {
f085be
+    m_aMediaDescriptor = rMediaDescriptor;
f085be
     //save
f085be
 
f085be
     sal_Int32 nWarning = 0;
f085be
@@ -751,9 +752,7 @@ sal_Int32 XMLFilter::impl_ExportStream(
f085be
         if ( !xFilter.is() )
f085be
             return ERRCODE_SFX_GENERAL;
f085be
 
f085be
-        uno::Sequence < beans::PropertyValue > aMediaDesc(0);
f085be
-        //@todo? filter properties? ... url? ...
f085be
-        xFilter->filter( aMediaDesc );
f085be
+        xFilter->filter(m_aMediaDescriptor);
f085be
     }
f085be
     catch (const uno::Exception& rEx)
f085be
     {
f085be
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
f085be
index 648e25f..d8bb956 100644
f085be
--- a/chart2/source/model/inc/XMLFilter.hxx
f085be
+++ b/chart2/source/model/inc/XMLFilter.hxx
f085be
@@ -152,6 +152,9 @@ private:
f085be
         ::com::sun::star::lang::XComponent >       m_xTargetDoc;
f085be
     ::com::sun::star::uno::Reference<
f085be
         ::com::sun::star::lang::XComponent >       m_xSourceDoc;
f085be
+
f085be
+    css::uno::Sequence<css::beans::PropertyValue> m_aMediaDescriptor;
f085be
+
f085be
     OUString                                m_sDocumentHandler; // when set it will be set as doc handler
f085be
 
f085be
     volatile bool                                  m_bCancelOperation;
f085be
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
f085be
index f8a3b90..c478068 100644
f085be
--- a/chart2/source/model/main/Axis.cxx
f085be
+++ b/chart2/source/model/main/Axis.cxx
f085be
@@ -65,7 +65,8 @@ enum
f085be
     PROP_AXIS_CROSSOVER_POSITION,
f085be
     PROP_AXIS_CROSSOVER_VALUE,
f085be
     PROP_AXIS_DISPLAY_LABELS,
f085be
-    PROP_AXIS_NUMBER_FORMAT,
f085be
+    PROP_AXIS_NUMBERFORMAT,
f085be
+    PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
f085be
     PROP_AXIS_LABEL_POSITION,
f085be
     PROP_AXIS_TEXT_ROTATION,
f085be
     PROP_AXIS_TEXT_BREAK,
f085be
@@ -110,10 +111,17 @@ void lcl_AddPropertiesToVector(
f085be
 
f085be
     rOutProperties.push_back(
f085be
         Property( "NumberFormat",
f085be
-                  PROP_AXIS_NUMBER_FORMAT,
f085be
-                  ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
f085be
+                  PROP_AXIS_NUMBERFORMAT,
f085be
+                  cppu::UnoType<sal_Int32>::get(),
f085be
                   beans::PropertyAttribute::BOUND
f085be
-                  | beans::PropertyAttribute::MAYBEVOID ));
f085be
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
f085be
+
f085be
+    rOutProperties.push_back(
f085be
+        Property( "LinkNumberFormatToSource",
f085be
+                  PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
f085be
+                  ::getBooleanCppuType(),
f085be
+                  beans::PropertyAttribute::BOUND
f085be
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
f085be
 
f085be
     rOutProperties.push_back(
f085be
         Property( "LabelPosition",
f085be
@@ -199,6 +207,7 @@ private:
f085be
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
f085be
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
f085be
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
f085be
+        ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true );
f085be
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
f085be
         ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
f085be
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
f085be
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
f085be
index 443101d..2aa4ca9 100644
f085be
--- a/chart2/source/model/main/DataPointProperties.cxx
f085be
+++ b/chart2/source/model/main/DataPointProperties.cxx
f085be
@@ -281,7 +281,14 @@ void DataPointProperties::AddPropertiesToVector(
f085be
                   PROP_DATAPOINT_NUMBER_FORMAT,
f085be
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
f085be
                   beans::PropertyAttribute::BOUND
f085be
-                  | beans::PropertyAttribute::MAYBEVOID ));
f085be
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
f085be
+
f085be
+    rOutProperties.push_back(
f085be
+        Property( "LinkNumberFormatToSource",
f085be
+                  PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
f085be
+                  ::getBooleanCppuType(),
f085be
+                  beans::PropertyAttribute::BOUND
f085be
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
f085be
 
f085be
     //additional 'PercentageNumberFormat'
f085be
     rOutProperties.push_back(
f085be
@@ -409,6 +416,8 @@ void DataPointProperties::AddDefaultsToMap(
f085be
     PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
f085be
 
f085be
     PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
f085be
+
f085be
+    PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, true);
f085be
 }
f085be
 
f085be
 } //  namespace chart
f085be
diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx
f085be
index 596adf8..2d7258a 100644
f085be
--- a/chart2/source/model/main/DataPointProperties.hxx
f085be
+++ b/chart2/source/model/main/DataPointProperties.hxx
f085be
@@ -62,6 +62,7 @@ public:
f085be
         PROP_DATAPOINT_LABEL,
f085be
         PROP_DATAPOINT_LABEL_SEPARATOR,
f085be
         PROP_DATAPOINT_NUMBER_FORMAT,
f085be
+        PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
f085be
         PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
f085be
         PROP_DATAPOINT_LABEL_PLACEMENT,
f085be
         PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
f085be
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
f085be
index b1ac7d22..8ff8563 100644
f085be
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
f085be
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
f085be
@@ -454,9 +454,8 @@ void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram
f085be
                 if( xAxisProp.is())
f085be
                 {
f085be
                     // set number format to source format
f085be
-                    uno::Any aValue( xAxisProp->getPropertyValue("NumberFormat"));
f085be
-                    if( aValue.hasValue())
f085be
-                        xAxisProp->setPropertyValue("NumberFormat", uno::Any());
f085be
+                    xAxisProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(true));
f085be
+                    xAxisProp->setPropertyValue("NumberFormat", uno::Any());
f085be
                 }
f085be
             }
f085be
         }
f085be
@@ -754,9 +753,8 @@ void ChartTypeTemplate::adaptAxes(
f085be
                             if( xAxisProp.is())
f085be
                             {
f085be
                                 // set number format to source format
f085be
-                                uno::Any aValue( xAxisProp->getPropertyValue("NumberFormat"));
f085be
-                                if( aValue.hasValue())
f085be
-                                    xAxisProp->setPropertyValue("NumberFormat", uno::Any());
f085be
+                                xAxisProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(true));
f085be
+                                xAxisProp->setPropertyValue("NumberFormat", uno::Any());
f085be
                             }
f085be
                         }
f085be
                     }
f085be
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
f085be
index 4b372ca..8291ca6 100644
f085be
--- a/chart2/source/tools/AxisHelper.cxx
f085be
+++ b/chart2/source/tools/AxisHelper.cxx
f085be
@@ -145,7 +145,16 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
f085be
     Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
f085be
 
f085be
     Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
f085be
-    if( xProp.is() && !( xProp->getPropertyValue( "NumberFormat" ) >>= nNumberFormatKey ) )
f085be
+    if (!xProp.is())
f085be
+        return 0;
f085be
+
f085be
+    bool bLinkToSource = true;
f085be
+    xProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource;
f085be
+    xProp->getPropertyValue("NumberFormat") >>= nNumberFormatKey;
f085be
+
f085be
+    sal_Int32 nOldNumberFormat = nNumberFormatKey;
f085be
+
f085be
+    if (bLinkToSource)
f085be
     {
f085be
         bool bFormatSet = false;
f085be
         //check whether we have a percent scale -> use percent format
f085be
@@ -314,7 +323,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
f085be
                 }
f085be
             }
f085be
         }
f085be
+
f085be
+        if (nOldNumberFormat != nNumberFormatKey)
f085be
+            xProp->setPropertyValue("NumberFormat", uno::makeAny(nNumberFormatKey));
f085be
     }
f085be
+
f085be
     return nNumberFormatKey;
f085be
 }
f085be
 
f085be
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
f085be
index f501aa9..c519aef 100644
f085be
--- a/chart2/source/view/main/ChartView.cxx
f085be
+++ b/chart2/source/view/main/ChartView.cxx
f085be
@@ -1787,8 +1787,16 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
f085be
     if( !xSeriesOrPointProp.is() )
f085be
         return nFormat;
f085be
 
f085be
-    OUString aPropName( "NumberFormat" );
f085be
-    if( !(xSeriesOrPointProp->getPropertyValue(aPropName) >>= nFormat) )
f085be
+    bool bLinkToSource = true;
f085be
+    try
f085be
+    {
f085be
+        xSeriesOrPointProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource;
f085be
+    }
f085be
+    catch ( const beans::UnknownPropertyException& ) {}
f085be
+
f085be
+    xSeriesOrPointProp->getPropertyValue("NumberFormat") >>= nFormat;
f085be
+    sal_Int32 nOldFormat = nFormat;
f085be
+    if (bLinkToSource)
f085be
     {
f085be
         uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
f085be
 
f085be
@@ -1796,7 +1804,7 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
f085be
         if( ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( xChartType ) )
f085be
         {
f085be
             uno::Reference< beans::XPropertySet > xAttachedAxisProps( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY );
f085be
-            if( xAttachedAxisProps.is() && ( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
f085be
+            if( xAttachedAxisProps.is() && ( xAttachedAxisProps->getPropertyValue("NumberFormat") >>= nFormat ) )
f085be
                 bFormatFound = true;
f085be
         }
f085be
         if( !bFormatFound )
f085be
@@ -1813,7 +1821,11 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
f085be
                     nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex );
f085be
             }
f085be
         }
f085be
+
f085be
+        if (nFormat >= 0 && nOldFormat != nFormat)
f085be
+            xSeriesOrPointProp->setPropertyValue("NumberFormat", uno::makeAny(nFormat));
f085be
     }
f085be
+
f085be
     if(nFormat<0)
f085be
         nFormat=0;
f085be
     return nFormat;
f085be
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
f085be
index 2d7df99..c3b4338 100644
f085be
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
f085be
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
f085be
@@ -493,7 +493,9 @@ void EmbeddedObjectContainer::AddEmbeddedObject( const ::com::sun::star::uno::Re
f085be
     }
f085be
 }
f085be
 
f085be
-sal_Bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, sal_Bool bCopy )
f085be
+bool EmbeddedObjectContainer::StoreEmbeddedObject(
f085be
+    const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, bool bCopy,
f085be
+    const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
     SAL_INFO( "comphelper.container", "comphelper (mv76033) comphelper::EmbeddedObjectContainer::StoreEmbeddedObject" );
f085be
 
f085be
@@ -514,7 +516,14 @@ sal_Bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < em
f085be
         {
f085be
             uno::Sequence < beans::PropertyValue > aSeq;
f085be
             if ( bCopy )
f085be
-                xPersist->storeToEntry( pImpl->mxStorage, rName, aSeq, aSeq );
f085be
+            {
f085be
+                uno::Sequence<beans::PropertyValue> aObjArgs(2);
f085be
+                aObjArgs[0].Name = "SourceShellID";
f085be
+                aObjArgs[0].Value <<= rSrcShellID;
f085be
+                aObjArgs[1].Name = "DestinationShellID";
f085be
+                aObjArgs[1].Value <<= rDestShellID;
f085be
+                xPersist->storeToEntry(pImpl->mxStorage, rName, aSeq, aObjArgs);
f085be
+            }
f085be
             else
f085be
             {
f085be
                 //TODO/LATER: possible optimisation, don't store immediately
f085be
@@ -538,7 +547,7 @@ sal_Bool EmbeddedObjectContainer::InsertEmbeddedObject( const uno::Reference < e
f085be
 {
f085be
     SAL_INFO( "comphelper.container", "comphelper (mv76033) comphelper::EmbeddedObjectContainer::InsertEmbeddedObject( Object )" );
f085be
     // store it into the container storage
f085be
-    if ( StoreEmbeddedObject( xObj, rName, sal_False ) )
f085be
+    if (StoreEmbeddedObject(xObj, rName, false, OUString(), OUString()))
f085be
     {
f085be
         // remember object
f085be
         AddEmbeddedObject( xObj, rName );
f085be
@@ -700,7 +709,9 @@ sal_Bool EmbeddedObjectContainer::TryToCopyGraphReplacement( EmbeddedObjectConta
f085be
     return bResult;
f085be
 }
f085be
 
f085be
-uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName )
f085be
+uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject(
f085be
+    EmbeddedObjectContainer& rSrc, const uno::Reference <embed::XEmbeddedObject>& xObj, OUString& rName,
f085be
+    const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
     SAL_INFO( "comphelper.container", "comphelper (mv76033) comphelper::EmbeddedObjectContainer::CopyAndGetEmbeddedObject" );
f085be
 
f085be
@@ -721,8 +732,8 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
f085be
     if ( rName.isEmpty() )
f085be
         rName = CreateUniqueObjectName();
f085be
 
f085be
-    // objects without persistance are not really stored by the method
f085be
-    if ( xObj.is() && StoreEmbeddedObject( xObj, rName, sal_True ) )
f085be
+    // objects without persistence are not really stored by the method
f085be
+    if (xObj.is() && StoreEmbeddedObject(xObj, rName, true, rSrcShellID, rDestShellID))
f085be
     {
f085be
         xResult = Get_Impl( rName, xObj);
f085be
         if ( !xResult.is() )
f085be
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
f085be
index 32c05ce..47e4d2f 100644
f085be
--- a/dbaccess/source/ui/browser/dbexchange.cxx
f085be
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
f085be
@@ -159,7 +159,7 @@ namespace dbaui
f085be
         ODataAccessObjectTransferable::AddSupportedFormats();
f085be
     }
f085be
 
f085be
-    sal_Bool ODataClipboard::GetData( const DataFlavor& rFlavor )
f085be
+    sal_Bool ODataClipboard::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
     {
f085be
         const sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
f085be
         switch (nFormat)
f085be
@@ -175,7 +175,7 @@ namespace dbaui
f085be
                 return m_pHtml.is() && SetObject( m_pHtml.get(), SOT_FORMATSTR_ID_HTML, rFlavor );
f085be
         }
f085be
 
f085be
-        return ODataAccessObjectTransferable::GetData( rFlavor );
f085be
+        return ODataAccessObjectTransferable::GetData(rFlavor, rDestDoc);
f085be
     }
f085be
 
f085be
     void ODataClipboard::ObjectReleased()
f085be
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
f085be
index 2bf549a..d705300 100644
f085be
--- a/dbaccess/source/ui/inc/JoinExchange.hxx
f085be
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
f085be
@@ -61,7 +61,7 @@ namespace dbaui
f085be
 
f085be
     protected:
f085be
         virtual void                AddSupportedFormats();
f085be
-        virtual sal_Bool            GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool            GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void                DragFinished( sal_Int8 nDropAction );
f085be
 
f085be
         static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
f085be
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx
f085be
index 0f03474..a298a5b 100644
f085be
--- a/dbaccess/source/ui/inc/TableRowExchange.hxx
f085be
+++ b/dbaccess/source/ui/inc/TableRowExchange.hxx
f085be
@@ -34,7 +34,7 @@ namespace dbaui
f085be
         OTableRowExchange(const ::std::vector< ::boost::shared_ptr<OTableRow> >& _rvTableRow);
f085be
     protected:
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
         virtual void        ObjectReleased();
f085be
     };
f085be
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
f085be
index f194213..c8d9852 100644
f085be
--- a/dbaccess/source/ui/inc/dbexchange.hxx
f085be
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
f085be
@@ -73,7 +73,7 @@ namespace dbaui
f085be
 
f085be
     protected:
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        ObjectReleased();
f085be
         virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     };
f085be
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
f085be
index 70007d7..8efc796 100644
f085be
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
f085be
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
f085be
@@ -116,7 +116,7 @@ namespace dbaui
f085be
             AddFormat( SOT_FORMATSTR_ID_SBA_TABID );
f085be
     }
f085be
 
f085be
-    sal_Bool OJoinExchObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+    sal_Bool OJoinExchObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         sal_uInt32 nFormat = SotExchange::GetFormat(rFlavor);
f085be
         if ( SOT_FORMATSTR_ID_SBA_JOIN == nFormat )
f085be
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
f085be
index 3a14971..a593b09 100644
f085be
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
f085be
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
f085be
@@ -52,7 +52,7 @@ namespace dbaui
f085be
         if ( !m_vTableRow.empty() )
f085be
             AddFormat(SOT_FORMATSTR_ID_SBA_TABED);
f085be
     }
f085be
-    sal_Bool OTableRowExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+    sal_Bool OTableRowExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
f085be
         if(nFormat == SOT_FORMATSTR_ID_SBA_TABED)
f085be
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
f085be
index 36741eb..4891656 100644
f085be
--- a/embeddedobj/source/commonembedding/persistence.cxx
f085be
+++ b/embeddedobj/source/commonembedding/persistence.cxx
f085be
@@ -723,12 +723,33 @@ void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< docum
f085be
         m_xRecoveryStorage.clear();
f085be
 }
f085be
 
f085be
-//------------------------------------------------------
f085be
-void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage,
f085be
-                                                    sal_Int32 nStorageFormat,
f085be
-                                                    const OUString& aBaseURL,
f085be
-                                                    const OUString& aHierarchName,
f085be
-                                                    sal_Bool bAttachToTheStorage )
f085be
+namespace {
f085be
+
f085be
+OUString getStringPropertyValue( const uno::Sequence<beans::PropertyValue>& rProps, const OUString& rName )
f085be
+{
f085be
+    OUString aStr;
f085be
+
f085be
+    for (sal_Int32 i = 0; i < rProps.getLength(); ++i)
f085be
+    {
f085be
+        if (rProps[i].Name == rName)
f085be
+        {
f085be
+            rProps[i].Value >>= aStr;
f085be
+            break;
f085be
+        }
f085be
+    }
f085be
+
f085be
+    return aStr;
f085be
+}
f085be
+
f085be
+}
f085be
+
f085be
+void OCommonEmbeddedObject::StoreDocToStorage_Impl(
f085be
+    const uno::Reference<embed::XStorage>& xStorage,
f085be
+    const uno::Sequence<beans::PropertyValue>& rMediaArgs,
f085be
+    const uno::Sequence<beans::PropertyValue>& rObjArgs,
f085be
+    sal_Int32 nStorageFormat,
f085be
+    const OUString& aHierarchName,
f085be
+    bool bAttachToTheStorage )
f085be
 {
f085be
     SAL_WARN_IF( !xStorage.is(), "embeddedobj.common", "No storage is provided for storing!" );
f085be
 
f085be
@@ -742,6 +763,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed:
f085be
             xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
f085be
     }
f085be
 
f085be
+    OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs);
f085be
+
f085be
     if ( xDoc.is() )
f085be
     {
f085be
         OUString aFilterName = GetFilterName( nStorageFormat );
f085be
@@ -750,13 +773,17 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed:
f085be
         if ( aFilterName.isEmpty() )
f085be
             throw io::IOException(); // TODO:
f085be
 
f085be
-        uno::Sequence< beans::PropertyValue > aArgs( 3 );
f085be
+        uno::Sequence<beans::PropertyValue> aArgs(5);
f085be
         aArgs[0].Name = "FilterName";
f085be
         aArgs[0].Value <<= aFilterName;
f085be
-        aArgs[2].Name = "DocumentBaseURL";
f085be
-        aArgs[2].Value <<= aBaseURL;
f085be
         aArgs[1].Name = "HierarchicalDocumentName";
f085be
         aArgs[1].Value <<= aHierarchName;
f085be
+        aArgs[2].Name = "DocumentBaseURL";
f085be
+        aArgs[2].Value <<= aBaseURL;
f085be
+        aArgs[3].Name = "SourceShellID";
f085be
+        aArgs[3].Value <<= getStringPropertyValue(rObjArgs, "SourceShellID");
f085be
+        aArgs[4].Name = "DestinationShellID";
f085be
+        aArgs[4].Value <<= getStringPropertyValue(rObjArgs, "DestinationShellID");
f085be
 
f085be
         xDoc->storeToStorage( xStorage, aArgs );
f085be
         if ( bAttachToTheStorage )
f085be
@@ -1241,7 +1268,8 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed::
f085be
 
f085be
         aGuard.clear();
f085be
         // TODO/LATER: support hierarchical name for embedded objects in embedded objects
f085be
-        StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, sal_False );
f085be
+        StoreDocToStorage_Impl(
f085be
+            xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false );
f085be
         aGuard.reset();
f085be
 
f085be
         if ( bSwitchBackToLoaded )
f085be
@@ -1380,7 +1408,8 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed::
f085be
     {
f085be
         aGuard.clear();
f085be
         // TODO/LATER: support hierarchical name for embedded objects in embedded objects
f085be
-        StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, sal_False );
f085be
+        StoreDocToStorage_Impl(
f085be
+            xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false );
f085be
         aGuard.reset();
f085be
 
f085be
         if ( bSwitchBackToLoaded )
f085be
@@ -1609,7 +1638,8 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
f085be
         }
f085be
 
f085be
         aGuard.clear();
f085be
-        StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, sal_True );
f085be
+        uno::Sequence<beans::PropertyValue> aEmpty;
f085be
+        StoreDocToStorage_Impl( m_xObjectStorage, aEmpty, aEmpty, nStorageFormat, m_aEntryName, true );
f085be
         aGuard.reset();
f085be
     }
f085be
 
f085be
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
f085be
index fba8d21..83e4445 100644
f085be
--- a/embeddedobj/source/inc/commonembobj.hxx
f085be
+++ b/embeddedobj/source/inc/commonembobj.hxx
f085be
@@ -197,11 +197,13 @@ private:
f085be
 
f085be
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > InitNewDocument_Impl();
f085be
 
f085be
-    void StoreDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
f085be
-                                sal_Int32 nStorageVersion,
f085be
-                                const OUString& aBaseURL,
f085be
-                                const OUString& aHierarchName,
f085be
-                                sal_Bool bAttachToStorage );
f085be
+    void StoreDocToStorage_Impl(
f085be
+        const css::uno::Reference<css::embed::XStorage>& xStorage,
f085be
+        const css::uno::Sequence<css::beans::PropertyValue>& rMediaArgs,
f085be
+        const css::uno::Sequence<css::beans::PropertyValue>& rObjArgs,
f085be
+        sal_Int32 nStorageVersion,
f085be
+        const OUString& aHierarchName,
f085be
+        bool bAttachToStorage );
f085be
 
f085be
     void SwitchDocToStorage_Impl(
f085be
             const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc,
f085be
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
f085be
index 7ce0566..616ca0f 100644
f085be
--- a/include/comphelper/embeddedobjectcontainer.hxx
f085be
+++ b/include/comphelper/embeddedobjectcontainer.hxx
f085be
@@ -58,7 +58,9 @@ class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
f085be
 
f085be
 public:
f085be
     // add an embedded object to the container storage
f085be
-    sal_Bool            StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString&, sal_Bool );
f085be
+    bool StoreEmbeddedObject(
f085be
+        const css::uno::Reference<css::embed::XEmbeddedObject>& xObj, OUString& rName, bool bCopy,
f085be
+        const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
 
f085be
     // add an embedded object that has been imported from the container storage - should only be called by filters!
f085be
     void                AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const OUString& );
f085be
@@ -119,7 +121,9 @@ public:
f085be
                         InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, OUString& );
f085be
 
f085be
     // copy an embedded object into the storage, open the new copy and return it
f085be
-    ::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 );
f085be
+    css::uno::Reference <css::embed::XEmbeddedObject> CopyAndGetEmbeddedObject(
f085be
+        EmbeddedObjectContainer& rSrc, const css::uno::Reference <css::embed::XEmbeddedObject>& xObj, OUString& rName,
f085be
+        const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
 
f085be
     // move an embedded object from one container to another one
f085be
     sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
f085be
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
f085be
index de041fbf..05aa6a7 100644
f085be
--- a/include/sfx2/objsh.hxx
f085be
+++ b/include/sfx2/objsh.hxx
f085be
@@ -239,6 +239,8 @@ public:
f085be
 
f085be
     using SotObject::GetInterface;
f085be
 
f085be
+    static OUString CreateShellID( const SfxObjectShell* pShell );
f085be
+
f085be
     // Document-Shell Iterator
f085be
     static SfxObjectShell*      GetFirst( const TypeId* pType = 0,
f085be
                                           sal_Bool bOnlyVisible = sal_True );
f085be
diff --git a/include/svtools/embedtransfer.hxx b/include/svtools/embedtransfer.hxx
f085be
index 2649188..186bc0c 100644
f085be
--- a/include/svtools/embedtransfer.hxx
f085be
+++ b/include/svtools/embedtransfer.hxx
f085be
@@ -33,10 +33,12 @@ private:
f085be
     Graphic* m_pGraphic;
f085be
     sal_Int64 m_nAspect;
f085be
 
f085be
+    OUString maParentShellID;
f085be
+
f085be
 protected:
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual void        ObjectReleased();
f085be
 
f085be
 public:
f085be
@@ -46,6 +48,8 @@ public:
f085be
                             sal_Int64 nAspect );
f085be
     ~SvEmbedTransferHelper();
f085be
 
f085be
+    void SetParentShellID( const OUString& rShellID );
f085be
+
f085be
     static void         FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc,
f085be
                             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
f085be
                             const Graphic* pGraphic,
f085be
diff --git a/include/svtools/stringtransfer.hxx b/include/svtools/stringtransfer.hxx
f085be
index 12d6fda..60d2ced 100644
f085be
--- a/include/svtools/stringtransfer.hxx
f085be
+++ b/include/svtools/stringtransfer.hxx
f085be
@@ -42,7 +42,7 @@ namespace svt
f085be
     protected:
f085be
         // TransferableHelper overridables
f085be
         virtual void                AddSupportedFormats();
f085be
-        virtual sal_Bool            GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor );
f085be
+        virtual sal_Bool            GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor, const OUString& rDestDoc );
f085be
     };
f085be
 
f085be
     //====================================================================
f085be
diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
f085be
index 2a8ce29..76c192f 100644
f085be
--- a/include/svtools/transfer.hxx
f085be
+++ b/include/svtools/transfer.hxx
f085be
@@ -28,7 +28,7 @@
f085be
 #include <cppuhelper/implbase4.hxx>
f085be
 #include <com/sun/star/frame/XTerminateListener.hpp>
f085be
 #include <com/sun/star/lang/XUnoTunnel.hpp>
f085be
-#include <com/sun/star/datatransfer/XTransferable.hpp>
f085be
+#include <com/sun/star/datatransfer/XTransferable2.hpp>
f085be
 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
f085be
 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
f085be
 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
f085be
@@ -127,7 +127,7 @@ struct ExecuteDropEvent
f085be
         mbDefault( sal_False ) {}
f085be
 };
f085be
 
f085be
-class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable,
f085be
+class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable2,
f085be
                                                            ::com::sun::star::datatransfer::clipboard::XClipboardOwner,
f085be
                                                            ::com::sun::star::datatransfer::dnd::XDragSourceListener,
f085be
                                                            ::com::sun::star::lang::XUnoTunnel >
f085be
@@ -178,6 +178,11 @@ private:
f085be
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException);
f085be
     virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException);
f085be
 
f085be
+    // Transferable2
f085be
+    virtual css::uno::Any SAL_CALL getTransferData2(
f085be
+        const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
+            throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException);
f085be
+
f085be
     // XEventListener
f085be
     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
f085be
 
f085be
@@ -236,7 +241,7 @@ protected:
f085be
 protected:
f085be
 
f085be
     virtual void        AddSupportedFormats() = 0;
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0;
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0;
f085be
     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     virtual void        DragFinished( sal_Int8 nDropAction );
f085be
     virtual void        ObjectReleased();
f085be
@@ -312,8 +317,8 @@ public:
f085be
 
f085be
 public:
f085be
 
f085be
-    ::com::sun::star::uno::Any  GetAny( SotFormatStringId nFormat ) const;
f085be
-    ::com::sun::star::uno::Any  GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
f085be
+    css::uno::Any GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const;
f085be
+    css::uno::Any GetAny( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
f085be
 
f085be
     sal_Bool                    GetString( SotFormatStringId nFormat, OUString& rStr );
f085be
     sal_Bool                    GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
f085be
@@ -342,16 +347,16 @@ public:
f085be
     sal_Bool                    GetFileList( SotFormatStringId nFormat, FileList& rFileList );
f085be
     sal_Bool                    GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
f085be
 
f085be
-    sal_Bool                    GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
f085be
-    sal_Bool                    GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
f085be
+    css::uno::Sequence<sal_Int8> GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc );
f085be
+    css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
-    sal_Bool                    GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
f085be
-    sal_Bool                    GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
f085be
+    bool                        GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
f085be
+    bool                        GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
f085be
 
f085be
-    sal_Bool                    GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
f085be
-    sal_Bool                    GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
f085be
+    css::uno::Reference<css::io::XInputStream> GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc );
f085be
+    css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
-    sal_Bool                    GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
f085be
+    bool                        GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
f085be
 
f085be
 public:
f085be
 
f085be
@@ -485,7 +490,7 @@ class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
f085be
 protected:
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual void        DragFinished( sal_Int8 nDropAction );
f085be
 
f085be
 public:
f085be
diff --git a/include/svx/dbaexchange.hxx b/include/svx/dbaexchange.hxx
f085be
index e6fef35..1761df1 100644
f085be
--- a/include/svx/dbaexchange.hxx
f085be
+++ b/include/svx/dbaexchange.hxx
f085be
@@ -148,7 +148,7 @@ namespace svx
f085be
     protected:
f085be
         // TransferableHelper overridables
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
         static sal_uInt32   getDescriptorFormatId();
f085be
 
f085be
@@ -226,7 +226,7 @@ namespace svx
f085be
 
f085be
     protected:
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        ObjectReleased();
f085be
 
f085be
     protected:
f085be
@@ -276,7 +276,7 @@ namespace svx
f085be
 
f085be
     protected:
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        ObjectReleased();
f085be
         static sal_uInt32   getDescriptorFormatId();
f085be
     };
f085be
diff --git a/include/svx/dbaobjectex.hxx b/include/svx/dbaobjectex.hxx
f085be
index 429477e..efd6c0e 100644
f085be
--- a/include/svx/dbaobjectex.hxx
f085be
+++ b/include/svx/dbaobjectex.hxx
f085be
@@ -64,7 +64,7 @@ namespace svx
f085be
     protected:
f085be
         // TransferableHelper overridables
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
         static sal_uInt32   getDescriptorFormatId(sal_Bool _bExtractForm);
f085be
     };
f085be
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
f085be
index af984ad..6c5c523 100644
f085be
--- a/include/svx/fmview.hxx
f085be
+++ b/include/svx/fmview.hxx
f085be
@@ -108,8 +108,6 @@ public:
f085be
 
f085be
     // for copying complete form structures, not only control models
f085be
     virtual SdrModel* GetMarkedObjModel() const;
f085be
-    using E3dView::Paste;
f085be
-    virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
 
f085be
     virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
f085be
 
f085be
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
f085be
index 7045a51..af7ae18 100644
f085be
--- a/include/svx/galmisc.hxx
f085be
+++ b/include/svx/galmisc.hxx
f085be
@@ -174,7 +174,7 @@ protected:
f085be
 
f085be
     // TransferableHelper
f085be
     virtual void                    AddSupportedFormats();
f085be
-    virtual sal_Bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool                WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     virtual void                    DragFinished( sal_Int8 nDropAction );
f085be
     virtual void                    ObjectReleased();
f085be
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
f085be
index f1b3dbb..25b83b6 100644
f085be
--- a/include/svx/svdobj.hxx
f085be
+++ b/include/svx/svdobj.hxx
f085be
@@ -599,9 +599,10 @@ public:
f085be
       Note that this function uses operator= internally.
f085be
     */
f085be
     virtual SdrObject* Clone() const;
f085be
-    /**
f085be
-      Implemented mainly for the purposes of Clone().
f085be
-    */
f085be
+
f085be
+    virtual SdrObject* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const;
f085be
+
f085be
+    // implemented mainly for the purposes of Clone()
f085be
     SdrObject& operator=(const SdrObject& rObj);
f085be
 
f085be
     // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
f085be
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
f085be
index 0f1df14..149dc61 100644
f085be
--- a/include/svx/svdoole2.hxx
f085be
+++ b/include/svx/svdoole2.hxx
f085be
@@ -145,6 +145,9 @@ public:
f085be
     virtual OUString TakeObjNamePlural() const;
f085be
 
f085be
     SdrOle2Obj* Clone() const;
f085be
+    virtual SdrOle2Obj* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const;
f085be
+
f085be
+    SdrOle2Obj& assignFrom( const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
     SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
f085be
 
f085be
     virtual void NbcMove(const Size& rSize);
f085be
diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx
f085be
index 010df2e..3043f0f 100644
f085be
--- a/include/svx/svdxcgv.hxx
f085be
+++ b/include/svx/svdxcgv.hxx
f085be
@@ -103,7 +103,10 @@ public:
f085be
     // View angezeigt wird.
f085be
     // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und
f085be
     // SDRINSERT_ADDMARK (siehe svdedtv.hxx).
f085be
-    virtual sal_Bool    Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
+    virtual sal_Bool Paste(
f085be
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+        const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
+
f085be
     sal_Bool            Paste(const OUString& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
     sal_Bool            Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
 
f085be
diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx
f085be
index 943cdb3..dfda739 100644
f085be
--- a/include/svx/view3d.hxx
f085be
+++ b/include/svx/view3d.hxx
f085be
@@ -98,7 +98,9 @@ public:
f085be
 
f085be
     // On Paste: We need to insert the objects of the Scene, but not the Scene itself
f085be
     using SdrView::Paste;
f085be
-    virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
+    virtual sal_Bool Paste(
f085be
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+        const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
 
f085be
     // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
f085be
     bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset);
f085be
diff --git a/include/svx/xmlexchg.hxx b/include/svx/xmlexchg.hxx
f085be
index 64de636..d1ce6d3 100644
f085be
--- a/include/svx/xmlexchg.hxx
f085be
+++ b/include/svx/xmlexchg.hxx
f085be
@@ -69,7 +69,7 @@ namespace svx
f085be
 
f085be
             // TransferableHelper overridables
f085be
             virtual void        AddSupportedFormats();
f085be
-            virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+            virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
             OXFormsDescriptor m_aDescriptor;
f085be
 
f085be
diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx
f085be
index d46663f..af866be 100644
f085be
--- a/include/xmloff/SchXMLExportHelper.hxx
f085be
+++ b/include/xmloff/SchXMLExportHelper.hxx
f085be
@@ -52,6 +52,9 @@ public:
f085be
     /// returns the string corresponding to the current FileFormat CLSID for Chart
f085be
     const OUString& getChartCLSID();
f085be
 
f085be
+    void SetSourceShellID( const OUString& rShellID );
f085be
+    void SetDestinationShellID( const OUString& rShellID );
f085be
+
f085be
 private:
f085be
     SchXMLExportHelper(); // not defined
f085be
     SchXMLExportHelper(SchXMLExportHelper &); // not defined
f085be
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
f085be
index 7ef8f3f..3612a7a 100644
f085be
--- a/include/xmloff/xmlexp.hxx
f085be
+++ b/include/xmloff/xmlexp.hxx
f085be
@@ -212,6 +212,9 @@ protected:
f085be
 
f085be
     void SetExtended( sal_Bool bSet=sal_True ) { mbExtended = bSet; }
f085be
 
f085be
+    OUString GetSourceShellID() const;
f085be
+    OUString GetDestinationShellID() const;
f085be
+
f085be
     // save linked sections? (may be false in global documents)
f085be
     sal_Bool mbSaveLinkedSections;
f085be
 
f085be
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
f085be
index d42a0e7..3c1d92e 100755
f085be
--- a/offapi/UnoApi_offapi.mk
f085be
+++ b/offapi/UnoApi_offapi.mk
f085be
@@ -2100,6 +2100,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/datatransfer,\
f085be
 	XSystemTransferable \
f085be
 	XTransferDataAccess \
f085be
 	XTransferable \
f085be
+	XTransferable2 \
f085be
 	XTransferableEx \
f085be
 	XTransferableSource \
f085be
 	XTransferableSupplier \
f085be
diff --git a/offapi/com/sun/star/datatransfer/XTransferable2.idl b/offapi/com/sun/star/datatransfer/XTransferable2.idl
f085be
new file mode 100644
f085be
index 0000000..5ff7d58
f085be
--- /dev/null
f085be
+++ b/offapi/com/sun/star/datatransfer/XTransferable2.idl
f085be
@@ -0,0 +1,41 @@
f085be
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
f085be
+/*
f085be
+ * This Source Code Form is subject to the terms of the Mozilla Public
f085be
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
f085be
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f085be
+ */
f085be
+
f085be
+#ifndef __com_sun_star_datatransfer_XTransferable2_idl__
f085be
+#define __com_sun_star_datatransfer_XTransferable2_idl__
f085be
+
f085be
+#include <com/sun/star/datatransfer/XTransferable2.idl>
f085be
+
f085be
+module com { module sun { module star { module datatransfer {
f085be
+
f085be
+interface XTransferable2 : com::sun::star::datatransfer::XTransferable
f085be
+{
f085be
+    /** This is equivalent of getTransferData of XTransferable, but takes an
f085be
+        additional parameter that specifies the destination document type.
f085be
+
f085be
+        @param aFlavor requested data format
f085be
+        @param aDestShellID destination document shell ID.  The ID of each
f085be
+        individual shell must be unique.
f085be
+
f085be
+        @returns data in specified data format.
f085be
+
f085be
+        @throws com::sun::star::io::IOException
f085be
+        if the data is no longer available in the requested flavor.
f085be
+
f085be
+        @throws com::sun::star::datatransfer::UnsupportedFlavorException
f085be
+        if the requested DataFlavor is not supported.
f085be
+     */
f085be
+    any getTransferData2( [in] DataFlavor aFlavor, [in] string aDestShellID )
f085be
+        raises ( UnsupportedFlavorException, com::sun::star::io::IOException );
f085be
+};
f085be
+
f085be
+}; }; }; };
f085be
+
f085be
+#endif
f085be
+
f085be
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
f085be
+
f085be
diff --git a/reportdesign/source/ui/dlg/GroupExchange.cxx b/reportdesign/source/ui/dlg/GroupExchange.cxx
f085be
index 06753d8..2e13979 100644
f085be
--- a/reportdesign/source/ui/dlg/GroupExchange.cxx
f085be
+++ b/reportdesign/source/ui/dlg/GroupExchange.cxx
f085be
@@ -48,8 +48,8 @@ namespace rptui
f085be
             AddFormat(OGroupExchange::getReportGroupId());
f085be
         }
f085be
     }
f085be
-    // -----------------------------------------------------------------------------
f085be
-    sal_Bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+
f085be
+    sal_Bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
f085be
         if(nFormat == OGroupExchange::getReportGroupId() )
f085be
diff --git a/reportdesign/source/ui/dlg/GroupExchange.hxx b/reportdesign/source/ui/dlg/GroupExchange.hxx
f085be
index 01eb437..f45ce99 100644
f085be
--- a/reportdesign/source/ui/dlg/GroupExchange.hxx
f085be
+++ b/reportdesign/source/ui/dlg/GroupExchange.hxx
f085be
@@ -37,7 +37,7 @@ namespace rptui
f085be
         static sal_uInt32   getReportGroupId();
f085be
     protected:
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        ObjectReleased();
f085be
     };
f085be
 }
f085be
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
f085be
index 0bfdd46..09b5e3c 100644
f085be
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
f085be
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
f085be
@@ -278,7 +278,7 @@ sal_Int8 OFieldExpressionControl::ExecuteDrop( const BrowserExecuteDropEvent& rE
f085be
         SetNoSelection();
f085be
 
f085be
         TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
f085be
-        uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId());
f085be
+        uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId(), OUString());
f085be
         uno::Sequence< uno::Any > aGroups;
f085be
         aDrop >>= aGroups;
f085be
         if ( aGroups.getLength() )
f085be
@@ -881,7 +881,7 @@ void OFieldExpressionControl::InsertRows( long nRow )
f085be
         SotExchange::GetFormatDataFlavor(OGroupExchange::getReportGroupId(), aFlavor);
f085be
         uno::Sequence< uno::Any > aGroups;
f085be
 
f085be
-        if( (aTransferData.GetAny(aFlavor) >>= aGroups) && aGroups.getLength() )
f085be
+        if ((aTransferData.GetAny(aFlavor, OUString()) >>= aGroups) && aGroups.getLength())
f085be
         {
f085be
             m_bIgnoreEvent = false;
f085be
             {
f085be
diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx
f085be
index 52b7f8d..5ea8eb5 100644
f085be
--- a/reportdesign/source/ui/inc/dlgedclip.hxx
f085be
+++ b/reportdesign/source/ui/inc/dlgedclip.hxx
f085be
@@ -70,7 +70,7 @@ public:
f085be
 protected:
f085be
     // TransferableHelper overridables
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 private:
f085be
     TSectionElements    m_aCopyElements;
f085be
 };
f085be
diff --git a/reportdesign/source/ui/report/dlgedclip.cxx b/reportdesign/source/ui/report/dlgedclip.cxx
f085be
index 48b334e..5bcebc9 100644
f085be
--- a/reportdesign/source/ui/report/dlgedclip.cxx
f085be
+++ b/reportdesign/source/ui/report/dlgedclip.cxx
f085be
@@ -51,15 +51,15 @@ void OReportExchange::AddSupportedFormats()
f085be
 {
f085be
     AddFormat(getDescriptorFormatId());
f085be
 }
f085be
-//--------------------------------------------------------------------
f085be
-sal_Bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor )
f085be
+
f085be
+sal_Bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
f085be
     return (nFormatId == getDescriptorFormatId()) ?
f085be
         SetAny( uno::Any(m_aCopyElements), _rFlavor )
f085be
         : sal_False;
f085be
 }
f085be
-// -----------------------------------------------------------------------------
f085be
+
f085be
 sal_Bool OReportExchange::canExtract(const DataFlavorExVector& _rFlavor)
f085be
 {
f085be
     return IsFormatSupported(_rFlavor,getDescriptorFormatId());
f085be
@@ -78,7 +78,7 @@ OReportExchange::TSectionElements OReportExchange::extractCopies(const Transfera
f085be
         SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
f085be
         OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid data format (no flavor)!");
f085be
 
f085be
-        uno::Any aDescriptor = _rData.GetAny(aFlavor);
f085be
+        uno::Any aDescriptor = _rData.GetAny(aFlavor, OUString());
f085be
 
f085be
         TSectionElements aCopies;
f085be
 #if OSL_DEBUG_LEVEL > 0
f085be
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
f085be
index bfc7a54..1cac044 100644
f085be
--- a/sc/inc/column.hxx
f085be
+++ b/sc/inc/column.hxx
f085be
@@ -27,6 +27,7 @@
f085be
 #include "types.hxx"
f085be
 #include "mtvelements.hxx"
f085be
 #include "formula/types.hxx"
f085be
+#include <svl/zforlist.hxx>
f085be
 
f085be
 #include <set>
f085be
 #include <vector>
f085be
@@ -226,7 +227,10 @@ public:
f085be
         SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag, bool bBroadcast = true );
f085be
     void CopyToClip(
f085be
         sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
f085be
-    void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
f085be
+
f085be
+    void CopyStaticToDocument(
f085be
+        SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
f085be
+
f085be
     void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
f085be
     bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
f085be
     bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
f085be
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
f085be
index 339bbb0..a2aea94 100644
f085be
--- a/sc/inc/document.hxx
f085be
+++ b/sc/inc/document.hxx
f085be
@@ -39,6 +39,7 @@
f085be
 #include "calcmacros.hxx"
f085be
 #include <tools/fract.hxx>
f085be
 #include <tools/gen.hxx>
f085be
+#include <svl/zforlist.hxx>
f085be
 
f085be
 #include <memory>
f085be
 #include <map>
f085be
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
f085be
index ba7745d..fe8adb6 100644
f085be
--- a/sc/inc/table.hxx
f085be
+++ b/sc/inc/table.hxx
f085be
@@ -412,7 +412,11 @@ public:
f085be
     void        DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
f085be
     void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
f085be
     void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
f085be
-    void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
f085be
+
f085be
+    void CopyStaticToDocument(
f085be
+        SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
f085be
+        ScTable* pDestTab );
f085be
+
f085be
     void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
f085be
 
f085be
     bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
f085be
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
f085be
index 5e5cf43..2d0a018 100644
f085be
--- a/sc/source/core/data/column.cxx
f085be
+++ b/sc/source/core/data/column.cxx
f085be
@@ -1061,7 +1061,8 @@ void ScColumn::CopyToClip(
f085be
     rColumn.CellStorageModified();
f085be
 }
f085be
 
f085be
-void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol)
f085be
+void ScColumn::CopyStaticToDocument(
f085be
+    SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol )
f085be
 {
f085be
     if (nRow1 > nRow2)
f085be
         return;
f085be
@@ -1170,6 +1171,17 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
f085be
             break;
f085be
     }
f085be
 
f085be
+    // Dont' forget to copy the number formats over.  Charts may reference them.
f085be
+    for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
f085be
+    {
f085be
+        sal_uInt32 nNumFmt = GetNumberFormat(nRow);
f085be
+        SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt);
f085be
+        if (itNum != rMap.end())
f085be
+            nNumFmt = itNum->second;
f085be
+
f085be
+        rDestCol.SetNumberFormat(nRow, nNumFmt);
f085be
+    }
f085be
+
f085be
     rDestCol.CellStorageModified();
f085be
 }
f085be
 
f085be
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
f085be
index 2ec7d68..b739df7 100644
f085be
--- a/sc/source/core/data/document.cxx
f085be
+++ b/sc/source/core/data/document.cxx
f085be
@@ -2148,8 +2148,12 @@ void ScDocument::CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab,
f085be
     if (!pSrcTab || !pDestTab)
f085be
         return;
f085be
 
f085be
+    pDestDoc->GetFormatTable()->MergeFormatter(*GetFormatTable());
f085be
+    SvNumberFormatterMergeMap aMap = pDestDoc->GetFormatTable()->ConvertMergeTableToMap();
f085be
+
f085be
     pSrcTab->CopyStaticToDocument(
f085be
-        rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(), pDestTab);
f085be
+        rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(),
f085be
+        aMap, pDestTab);
f085be
 }
f085be
 
f085be
 void ScDocument::CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc )
f085be
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
f085be
index b858a1c..3f0d190 100644
f085be
--- a/sc/source/core/data/table2.cxx
f085be
+++ b/sc/source/core/data/table2.cxx
f085be
@@ -554,7 +554,8 @@ void ScTable::CopyToClip(
f085be
     }
f085be
 }
f085be
 
f085be
-void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab)
f085be
+void ScTable::CopyStaticToDocument(
f085be
+    SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScTable* pDestTab )
f085be
 {
f085be
     if (nCol1 > nCol2)
f085be
         return;
f085be
@@ -563,7 +564,7 @@ void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW
f085be
     {
f085be
         ScColumn& rSrcCol = aCol[i];
f085be
         ScColumn& rDestCol = pDestTab->aCol[i];
f085be
-        rSrcCol.CopyStaticToDocument(nRow1, nRow2, rDestCol);
f085be
+        rSrcCol.CopyStaticToDocument(nRow1, nRow2, rMap, rDestCol);
f085be
     }
f085be
 }
f085be
 
f085be
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
f085be
index 63a81c0..9cb5a22 100644
f085be
--- a/sc/source/ui/app/drwtrans.cxx
f085be
+++ b/sc/source/ui/app/drwtrans.cxx
f085be
@@ -95,7 +95,8 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
f085be
     pDragSourceView( NULL ),
f085be
     nDragSourceFlags( 0 ),
f085be
     bDragWasInternal( false ),
f085be
-    nSourceDocID( 0 )
f085be
+    nSourceDocID( 0 ),
f085be
+    maShellID(SfxObjectShell::CreateShellID(pContainerShell))
f085be
 {
f085be
     //
f085be
     //  check what kind of objects are contained
f085be
@@ -339,12 +340,8 @@ void ScDrawTransferObj::AddSupportedFormats()
f085be
         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
f085be
         AddFormat( SOT_FORMAT_GDIMETAFILE );
f085be
 
f085be
-        if ( !aOleData.GetTransferable().is() )
f085be
-        {
f085be
-            SdrOle2Obj* pObj = GetSingleObject();
f085be
-            if ( pObj && pObj->GetObjRef().is() )
f085be
-                aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ;
f085be
-        }
f085be
+        CreateOLEData();
f085be
+
f085be
         if ( aOleData.GetTransferable().is() )
f085be
         {
f085be
             //  get format list from object snapshot
f085be
@@ -376,19 +373,15 @@ void ScDrawTransferObj::AddSupportedFormats()
f085be
 //      AddFormat( SOT_FORMATSTR_ID_SVIM );
f085be
 }
f085be
 
f085be
-sal_Bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool ScDrawTransferObj::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
     sal_Bool bOK = false;
f085be
     sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
f085be
 
f085be
     if ( bOleObj && nFormat != SOT_FORMAT_GDIMETAFILE )
f085be
     {
f085be
-        if ( !aOleData.GetTransferable().is() )
f085be
-        {
f085be
-            SdrOle2Obj* pObj = GetSingleObject();
f085be
-            if ( pObj && pObj->GetObjRef().is() )
f085be
-                aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ;
f085be
-        }
f085be
+        CreateOLEData();
f085be
 
f085be
         if( aOleData.GetTransferable().is() && aOleData.HasFormat( rFlavor ) )
f085be
         {
f085be
@@ -400,7 +393,7 @@ sal_Bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataF
f085be
                 pModel->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE );
f085be
             }
f085be
 
f085be
-            bOK = SetAny( aOleData.GetAny( rFlavor ), rFlavor );
f085be
+            bOK = SetAny( aOleData.GetAny(rFlavor, rDestDoc), rFlavor );
f085be
 
f085be
             if( pModel )
f085be
                 pModel->SetSwapGraphicsMode( nOldSwapMode );
f085be
@@ -701,6 +694,11 @@ void ScDrawTransferObj::SetDragWasInternal()
f085be
     bDragWasInternal = sal_True;
f085be
 }
f085be
 
f085be
+OUString ScDrawTransferObj::GetShellID() const
f085be
+{
f085be
+    return maShellID;
f085be
+}
f085be
+
f085be
 SdrOle2Obj* ScDrawTransferObj::GetSingleObject()
f085be
 {
f085be
     //  if single OLE object was copied, get its object
f085be
@@ -719,7 +717,26 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject()
f085be
     return NULL;
f085be
 }
f085be
 
f085be
-//
f085be
+void ScDrawTransferObj::CreateOLEData()
f085be
+{
f085be
+    if (aOleData.GetTransferable().is())
f085be
+        // Already created.
f085be
+        return;
f085be
+
f085be
+    SdrOle2Obj* pObj = GetSingleObject();
f085be
+    if (!pObj || !pObj->GetObjRef().is())
f085be
+        // No OLE object present.
f085be
+        return;
f085be
+
f085be
+    SvEmbedTransferHelper* pEmbedTransfer =
f085be
+        new SvEmbedTransferHelper(
f085be
+            pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect());
f085be
+
f085be
+    pEmbedTransfer->SetParentShellID(maShellID);
f085be
+
f085be
+    aOleData = TransferableDataHelper(pEmbedTransfer);
f085be
+}
f085be
+
f085be
 //  initialize aDocShellRef with a live document from the ClipDoc
f085be
 //
f085be
 
f085be
@@ -740,7 +757,10 @@ void ScDrawTransferObj::InitDocShell()
f085be
         // SdrExchangeView aDestView( pDestModel );
f085be
         SdrView aDestView( pDestModel );
f085be
         aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
f085be
-        aDestView.Paste( *pModel, Point( aSrcSize.Width()/2, aSrcSize.Height()/2 ) );
f085be
+        aDestView.Paste(
f085be
+            *pModel,
f085be
+            Point(aSrcSize.Width()/2, aSrcSize.Height()/2),
f085be
+            NULL, 0, OUString(), OUString());
f085be
 
f085be
         // put objects to right layer (see ScViewFunc::PasteDataFormat for SOT_FORMATSTR_ID_DRAWING)
f085be
 
f085be
diff --git a/sc/source/ui/app/lnktrans.cxx b/sc/source/ui/app/lnktrans.cxx
f085be
index 5733b14..d830e42 100644
f085be
--- a/sc/source/ui/app/lnktrans.cxx
f085be
+++ b/sc/source/ui/app/lnktrans.cxx
f085be
@@ -55,7 +55,8 @@ void ScLinkTransferObj::AddSupportedFormats()
f085be
     }
f085be
 }
f085be
 
f085be
-sal_Bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool ScLinkTransferObj::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_Bool bOK = false;
f085be
     if ( !aLinkURL.isEmpty() )
f085be
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
f085be
index 679a21e..9bedf0c 100644
f085be
--- a/sc/source/ui/app/seltrans.cxx
f085be
+++ b/sc/source/ui/app/seltrans.cxx
f085be
@@ -385,7 +385,8 @@ ScDrawTransferObj* ScSelectionTransferObj::GetDrawData()
f085be
     return pDrawData;
f085be
 }
f085be
 
f085be
-sal_Bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool ScSelectionTransferObj::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
     sal_Bool bOK = false;
f085be
 
f085be
@@ -412,7 +413,7 @@ sal_Bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::
f085be
     if ( xSource.is() )
f085be
     {
f085be
         TransferableDataHelper aHelper( xSource );
f085be
-        uno::Any aAny = aHelper.GetAny( rFlavor );
f085be
+        uno::Any aAny = aHelper.GetAny(rFlavor, rDestDoc);
f085be
         bOK = SetAny( aAny, rFlavor );
f085be
     }
f085be
 
f085be
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
f085be
index ec6bb4a..ba1aec8 100644
f085be
--- a/sc/source/ui/app/transobj.cxx
f085be
+++ b/sc/source/ui/app/transobj.cxx
f085be
@@ -246,7 +246,7 @@ void ScTransferObj::AddSupportedFormats()
f085be
         AddFormat( SOT_FORMATSTR_ID_EDITENGINE );
f085be
 }
f085be
 
f085be
-sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
f085be
     bool    bOK = false;
f085be
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
f085be
index 81b7b90..7f4a2c6 100644
f085be
--- a/sc/source/ui/inc/drwtrans.hxx
f085be
+++ b/sc/source/ui/inc/drwtrans.hxx
f085be
@@ -63,17 +63,20 @@ private:
f085be
 
f085be
     ScRangeListVector               m_aProtectedChartRangesVector;
f085be
 
f085be
+    OUString maShellID;
f085be
 
f085be
     void                InitDocShell();
f085be
     SdrOle2Obj* GetSingleObject();
f085be
 
f085be
+    void CreateOLEData();
f085be
+
f085be
 public:
f085be
             ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContainerShell,
f085be
                                 const TransferableObjectDescriptor& rDesc );
f085be
     virtual ~ScDrawTransferObj();
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
f085be
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     virtual void        ObjectReleased();
f085be
@@ -87,6 +90,8 @@ public:
f085be
     void                SetDragSourceFlags( sal_uInt16 nFlags );
f085be
     void                SetDragWasInternal();
f085be
 
f085be
+    OUString GetShellID() const;
f085be
+
f085be
     SdrView*            GetDragSourceView()             { return pDragSourceView; }
f085be
     sal_uInt16              GetDragSourceFlags() const      { return nDragSourceFlags; }
f085be
 
f085be
diff --git a/sc/source/ui/inc/lnktrans.hxx b/sc/source/ui/inc/lnktrans.hxx
f085be
index d9ccdeb..1f13e8a 100644
f085be
--- a/sc/source/ui/inc/lnktrans.hxx
f085be
+++ b/sc/source/ui/inc/lnktrans.hxx
f085be
@@ -36,7 +36,7 @@ public:
f085be
     void                SetLinkURL( const OUString& rURL, const OUString& rText );
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual void        ObjectReleased();
f085be
     virtual void        DragFinished( sal_Int8 nDropAction );
f085be
 };
f085be
diff --git a/sc/source/ui/inc/seltrans.hxx b/sc/source/ui/inc/seltrans.hxx
f085be
index ba4e184..ec2b6ac 100644
f085be
--- a/sc/source/ui/inc/seltrans.hxx
f085be
+++ b/sc/source/ui/inc/seltrans.hxx
f085be
@@ -65,7 +65,7 @@ public:
f085be
     ScDrawTransferObj*  GetDrawData();
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual void        ObjectReleased();
f085be
 };
f085be
 
f085be
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
f085be
index 9bd0d12..5ae33d0 100644
f085be
--- a/sc/source/ui/inc/transobj.hxx
f085be
+++ b/sc/source/ui/inc/transobj.hxx
f085be
@@ -72,7 +72,7 @@ public:
f085be
     virtual ~ScTransferObj();
f085be
 
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
f085be
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     virtual void        ObjectReleased();
f085be
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
f085be
index 0e28bb5..c598884 100644
f085be
--- a/sc/source/ui/inc/viewfunc.hxx
f085be
+++ b/sc/source/ui/inc/viewfunc.hxx
f085be
@@ -115,8 +115,8 @@ public:
f085be
                                                        ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
f085be
 
f085be
     void            PasteDraw();
f085be
-    void            PasteDraw( const Point& rLogicPos, SdrModel* pModel,
f085be
-                                sal_Bool bGroup = false, sal_Bool bSameDocClipboard = false );
f085be
+    void PasteDraw( const Point& rLogicPos, SdrModel* pModel, bool bGroup,
f085be
+                    const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
 
f085be
     sal_Bool            PasteOnDrawObject( const ::com::sun::star::uno::Reference<
f085be
                                             ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
f085be
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
f085be
index 1fa83c5..cd38c6d 100644
f085be
--- a/sc/source/ui/view/gridwin.cxx
f085be
+++ b/sc/source/ui/view/gridwin.cxx
f085be
@@ -4412,7 +4412,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
f085be
 
f085be
         bPasteIsMove = bIsMove;
f085be
 
f085be
-        pViewData->GetView()->PasteDraw( aLogicPos, rData.pDrawTransfer->GetModel() );
f085be
+        pViewData->GetView()->PasteDraw(
f085be
+            aLogicPos, rData.pDrawTransfer->GetModel(), false, "A", "B");
f085be
 
f085be
         if (bPasteIsMove)
f085be
             rData.pDrawTransfer->SetDragWasInternal();
f085be
@@ -4517,8 +4518,9 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
f085be
 
f085be
                 //  bSameDocClipboard argument for PasteDraw is needed
f085be
                 //  because only DragData is checked directly inside PasteDraw
f085be
-                pViewData->GetView()->PasteDraw( aLogicPos, pDrawTransfer->GetModel(), false,
f085be
-                            pDrawTransfer->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
f085be
+                pViewData->GetView()->PasteDraw(
f085be
+                    aLogicPos, pDrawTransfer->GetModel(), false,
f085be
+                    pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
f085be
             }
f085be
         }
f085be
     }
f085be
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
f085be
index f8454d3..5cb568d 100644
f085be
--- a/sc/source/ui/view/viewfun3.cxx
f085be
+++ b/sc/source/ui/view/viewfun3.cxx
f085be
@@ -449,8 +449,11 @@ void ScViewFunc::PasteDraw()
f085be
                                      pViewData->GetActivePart() ) );
f085be
     ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin );
f085be
     if (pDrawClip)
f085be
-        PasteDraw( aPos, pDrawClip->GetModel(), false,
f085be
-            pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
f085be
+    {
f085be
+        OUString aSrcShellID = pDrawClip->GetShellID();
f085be
+        OUString aDestShellID = SfxObjectShell::CreateShellID(pViewData->GetDocShell());
f085be
+        PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID);
f085be
+    }
f085be
 }
f085be
 
f085be
 void ScViewFunc::PasteFromSystem()
f085be
@@ -586,7 +589,9 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference
f085be
         SCROW nPosY = pViewData->GetCurY();
f085be
         Window* pWin = GetActiveWin();
f085be
         Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, pViewData->GetActivePart() ) );
f085be
-        PasteDraw( aPos, pDrawClip->GetModel(), false, pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
f085be
+        PasteDraw(
f085be
+            aPos, pDrawClip->GetModel(), false,
f085be
+            pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
f085be
     }
f085be
     else
f085be
     {
f085be
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
f085be
index 9319bd6..d5c3298 100644
f085be
--- a/sc/source/ui/view/viewfun5.cxx
f085be
+++ b/sc/source/ui/view/viewfun5.cxx
f085be
@@ -120,8 +120,10 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
f085be
         uno::Reference < io::XInputStream > xStm;
f085be
         TransferableObjectDescriptor   aObjDesc;
f085be
 
f085be
-        if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
f085be
-            aDataHelper.GetInputStream( nFormatId, xStm ) )
f085be
+        if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
f085be
+            xStm = aDataHelper.GetInputStream(nFormatId, OUString());
f085be
+
f085be
+        if (xStm.is())
f085be
         {
f085be
             if ( aObjDesc.maClassName == SvGlobalName( SO3_SC_CLASSID_60 ) )
f085be
             {
f085be
@@ -205,9 +207,11 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
f085be
             {
f085be
                 OUString aName;
f085be
                 uno::Reference < embed::XEmbeddedObject > xObj;
f085be
+                xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
f085be
+                if (!xStm.is())
f085be
+                    aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
f085be
 
f085be
-                if ( aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm )
f085be
-                  || aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
f085be
+                if (xStm.is())
f085be
                 {
f085be
                     xObj = GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
f085be
                 }
f085be
@@ -515,7 +519,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
f085be
                 nObjCount += pPage->GetObjCount();          // count group object only once
f085be
             }
f085be
 
f085be
-            PasteDraw( aPos, pModel, (nObjCount > 1) );     // grouped if more than 1 object
f085be
+            PasteDraw(aPos, pModel, (nObjCount > 1), "A", "B");     // grouped if more than 1 object
f085be
             delete pModel;
f085be
             aDragShellRef->DoClose();
f085be
             bRet = sal_True;
f085be
@@ -525,8 +529,8 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
f085be
     {
f085be
         //  do excel import into a clipboard document
f085be
         //TODO/MBA: testing
f085be
-        uno::Reference < io::XInputStream > xStm;
f085be
-        if( aDataHelper.GetInputStream( nFormatId, xStm ) )
f085be
+        uno::Reference <io::XInputStream> xStm = aDataHelper.GetInputStream(nFormatId, OUString());
f085be
+        if (xStm.is())
f085be
         {
f085be
             ScDocument* pInsDoc = new ScDocument( SCDOCMODE_CLIP );
f085be
             SCTAB nSrcTab = 0;      // Biff5 in clipboard: always sheet 0
f085be
@@ -626,8 +630,8 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
f085be
     //  get link data from transferable before string data,
f085be
     //  so the source knows it will be used for a link
f085be
 
f085be
-    uno::Sequence<sal_Int8> aSequence;
f085be
-    if ( !aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aSequence ) )
f085be
+    uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString());
f085be
+    if (!aSequence.getLength())
f085be
     {
f085be
         OSL_FAIL("DDE Data not found.");
f085be
         return false;
f085be
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
f085be
index 1904bce..7506f02 100644
f085be
--- a/sc/source/ui/view/viewfun7.cxx
f085be
+++ b/sc/source/ui/view/viewfun7.cxx
f085be
@@ -73,8 +73,10 @@ static void lcl_AdjustInsertPos( ScViewData* pData, Point& rPos, Size& rSize )
f085be
 }
f085be
 
f085be
 void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
f085be
-        sal_Bool bGroup, sal_Bool bSameDocClipboard )
f085be
+                            bool bGroup, const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
+    bool bSameDocClipboard = rSrcShellID == rDestShellID;
f085be
+
f085be
     MakeDrawLayer();
f085be
     Point aPos( rLogicPos );
f085be
 
f085be
@@ -219,7 +221,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
f085be
         if ( !bSameDocClipboard )
f085be
             GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( sal_True );
f085be
 
f085be
-        pScDrawView->Paste( *pModel, aPos, NULL, nOptions );
f085be
+        pScDrawView->Paste(*pModel, aPos, NULL, nOptions, rSrcShellID, rDestShellID);
f085be
 
f085be
         if ( !bSameDocClipboard )
f085be
             GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false );
f085be
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
f085be
index 2dcf5fa..2a24f4e 100644
f085be
--- a/sd/source/core/drawdoc3.cxx
f085be
+++ b/sd/source/core/drawdoc3.cxx
f085be
@@ -1049,7 +1049,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsObject(
f085be
             pBMView->GetDoc().SetAllocDocSh(true);
f085be
 
f085be
         SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetMarkedObjModel();
f085be
-        bOK = pView->Paste(*pTmpDoc, aObjPos, pPage);
f085be
+        bOK = pView->Paste(*pTmpDoc, aObjPos, pPage, 0, OUString(), OUString());
f085be
 
f085be
         if (bOLEObjFound)
f085be
             pBMView->GetDoc().SetAllocDocSh(false);
f085be
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
f085be
index d618df4..bd538b0 100644
f085be
--- a/sd/source/ui/app/sdxfer.cxx
f085be
+++ b/sd/source/ui/app/sdxfer.cxx
f085be
@@ -439,7 +439,7 @@ void SdTransferable::AddSupportedFormats()
f085be
     }
f085be
 }
f085be
 
f085be
-sal_Bool SdTransferable::GetData( const DataFlavor& rFlavor )
f085be
+sal_Bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
     if (SD_MOD()==NULL)
f085be
         return sal_False;
f085be
@@ -467,7 +467,7 @@ sal_Bool SdTransferable::GetData( const DataFlavor& rFlavor )
f085be
         if( nFormat == FORMAT_GDIMETAFILE && mpGraphic )
f085be
             bOK = SetGDIMetaFile( mpGraphic->GetGDIMetaFile(), rFlavor );
f085be
         else
f085be
-            bOK = SetAny( mpOLEDataHelper->GetAny( rFlavor ), rFlavor );
f085be
+            bOK = SetAny( mpOLEDataHelper->GetAny(rFlavor, rDestDoc), rFlavor );
f085be
 
f085be
         if( mpSdDrawDocumentIntern )
f085be
             mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
f085be
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
f085be
index 311d178..641da0a 100644
f085be
--- a/sd/source/ui/dlg/sdtreelb.cxx
f085be
+++ b/sd/source/ui/dlg/sdtreelb.cxx
f085be
@@ -124,7 +124,8 @@ void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats()
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_uLong nFormatId = SotExchange::GetFormat( rFlavor );
f085be
     switch (nFormatId)
f085be
diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx
f085be
index 4f45c09..1fa16bc 100644
f085be
--- a/sd/source/ui/inc/TabControl.hxx
f085be
+++ b/sd/source/ui/inc/TabControl.hxx
f085be
@@ -93,7 +93,7 @@ private:
f085be
         virtual             ~TabControlTransferable();
f085be
 
f085be
         virtual void        AddSupportedFormats();
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        DragFinished( sal_Int8 nDropAction );
f085be
 
f085be
     };
f085be
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
f085be
index 239b8fa..3b2c99a 100644
f085be
--- a/sd/source/ui/inc/View.hxx
f085be
+++ b/sd/source/ui/inc/View.hxx
f085be
@@ -172,7 +172,9 @@ public:
f085be
     virtual void onAccessibilityOptionsChanged();
f085be
 
f085be
     virtual SdrModel*   GetMarkedObjModel() const;
f085be
-    virtual sal_Bool        Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
f085be
+    virtual sal_Bool Paste(
f085be
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+        const OUString& rSrcShellID, const OUString& rDestShellID );
f085be
     using SdrExchangeView::Paste;
f085be
 
f085be
     /** returns true if we have an undo manager and there is an open list undo action */
f085be
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
f085be
index 252a403..4b1fb6f 100644
f085be
--- a/sd/source/ui/inc/sdtreelb.hxx
f085be
+++ b/sd/source/ui/inc/sdtreelb.hxx
f085be
@@ -97,7 +97,7 @@ public:
f085be
         SAL_DLLPRIVATE virtual               ~SdPageObjsTransferable();
f085be
 
f085be
         SAL_DLLPRIVATE virtual void      AddSupportedFormats();
f085be
-        SAL_DLLPRIVATE virtual sal_Bool  GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        SAL_DLLPRIVATE virtual sal_Bool  GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         SAL_DLLPRIVATE virtual void      DragFinished( sal_Int8 nDropAction );
f085be
 
f085be
         SAL_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
f085be
diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx
f085be
index 40c624e1..299f876 100644
f085be
--- a/sd/source/ui/inc/sdxfer.hxx
f085be
+++ b/sd/source/ui/inc/sdxfer.hxx
f085be
@@ -109,7 +109,7 @@ public:
f085be
 protected:
f085be
 
f085be
     virtual void                    AddSupportedFormats();
f085be
-    virtual sal_Bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool                WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
     virtual void                    ObjectReleased();
f085be
 
f085be
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
f085be
index 2572576..148fa45 100644
f085be
--- a/sd/source/ui/view/sdview2.cxx
f085be
+++ b/sd/source/ui/view/sdview2.cxx
f085be
@@ -977,9 +977,11 @@ SdrModel* View::GetMarkedObjModel() const
f085be
     return FmFormView::GetMarkedObjModel();;
f085be
 }
f085be
 
f085be
-sal_Bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */)
f085be
+sal_Bool View::Paste(
f085be
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+    const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
-    return FmFormView::Paste( rMod, rPos, pLst,nOptions );;
f085be
+    return FmFormView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID);
f085be
 }
f085be
 
f085be
 } // end of namespace sd
f085be
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
f085be
index 0aecf6a..9987aa5 100644
f085be
--- a/sd/source/ui/view/sdview3.cxx
f085be
+++ b/sd/source/ui/view/sdview3.cxx
f085be
@@ -602,7 +602,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
                     SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel();
f085be
                     pSourceDoc->CreatingDataObj( pOwnData );
f085be
                     SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetMarkedObjModel();
f085be
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
f085be
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
f085be
 
f085be
                     if( !pPage )
f085be
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
f085be
@@ -643,7 +643,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
                     pWorkModel->DeletePage( (sal_uInt16) i );
f085be
             }
f085be
 
f085be
-            bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions );
f085be
+            bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
f085be
 
f085be
             if( !pPage )
f085be
                 pPage = (SdPage*) GetSdrPageView()->GetPage();
f085be
@@ -802,7 +802,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
f085be
                     }
f085be
 
f085be
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
f085be
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
f085be
                 }
f085be
 
f085be
                 xShell->DoClose();
f085be
@@ -843,9 +843,15 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
         uno::Reference < io::XInputStream > xStm;
f085be
         TransferableObjectDescriptor    aObjDesc;
f085be
 
f085be
-        if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
f085be
-            ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) ||
f085be
-              aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) )
f085be
+        if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
f085be
+        {
f085be
+            OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh());
f085be
+            xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, aDocShellID);
f085be
+            if (!xStm.is())
f085be
+                xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ, aDocShellID);
f085be
+        }
f085be
+
f085be
+        if (xStm.is())
f085be
         {
f085be
             if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
f085be
             {
f085be
@@ -879,7 +885,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
                             pModel->DeletePage( (sal_uInt16) i );
f085be
                     }
f085be
 
f085be
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
f085be
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
f085be
 
f085be
                     if( !pPage )
f085be
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
f085be
@@ -1028,8 +1034,11 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
f085be
                 uno::Reference < embed::XEmbeddedObject > xObj;
f085be
                 OUString aName;
f085be
 
f085be
-                if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) ||
f085be
-                    aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
f085be
+                xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
f085be
+                if (!xStm.is())
f085be
+                    xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
f085be
+
f085be
+                if (xStm.is())
f085be
                 {
f085be
                     xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
f085be
                 }
f085be
@@ -1505,7 +1514,7 @@ bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nP
f085be
     pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
f085be
 
f085be
     CreateTableFromRTF( *xStm, pModel );
f085be
-    bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions );
f085be
+    bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
f085be
 
f085be
     xComponent->dispose();
f085be
     xComponent.clear();
f085be
diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx
f085be
index 0dec8d6..f963d33 100644
f085be
--- a/sd/source/ui/view/tabcontr.cxx
f085be
+++ b/sd/source/ui/view/tabcontr.cxx
f085be
@@ -62,7 +62,7 @@ void TabControl::TabControlTransferable::AddSupportedFormats()
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& )
f085be
+sal_Bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor&, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     return sal_False;
f085be
 }
f085be
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
f085be
index befa7ae..91a20e3 100644
f085be
--- a/sfx2/source/doc/objxtor.cxx
f085be
+++ b/sfx2/source/doc/objxtor.cxx
f085be
@@ -480,7 +480,24 @@ bool SfxObjectShell::Close()
f085be
     return true;
f085be
 }
f085be
 
f085be
-//--------------------------------------------------------------------
f085be
+OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell )
f085be
+{
f085be
+    if (!pShell)
f085be
+        return OUString();
f085be
+
f085be
+    OUString aShellID;
f085be
+
f085be
+    SfxMedium* pMedium = pShell->GetMedium();
f085be
+    if (pMedium)
f085be
+        aShellID = pMedium->GetBaseURL();
f085be
+
f085be
+    if (!aShellID.isEmpty())
f085be
+        return aShellID;
f085be
+
f085be
+    sal_Int64 nShellID = reinterpret_cast<sal_Int64>(pShell);
f085be
+    aShellID = "0x" + OUString::number(nShellID, 16);
f085be
+    return aShellID;
f085be
+}
f085be
 
f085be
 // returns a pointer the first SfxDocument of specified type
f085be
 
f085be
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
f085be
index 445b0be..0bc05d1 100644
f085be
--- a/starmath/source/view.cxx
f085be
+++ b/starmath/source/view.cxx
f085be
@@ -1607,8 +1607,10 @@ void SmViewShell::Execute(SfxRequest& rReq)
f085be
             if( aData.GetTransferable().is() &&
f085be
                 ( aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ||
f085be
                   (aData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) &&
f085be
-                   aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE ))) &&
f085be
-                aData.GetInputStream( nId, xStrm ) && xStrm.is() )
f085be
+                   aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE ))))
f085be
+                xStrm = aData.GetInputStream(nId, OUString());
f085be
+
f085be
+            if (xStrm.is())
f085be
             {
f085be
                 try
f085be
                 {
f085be
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
f085be
index ec29608..7729ae2 100644
f085be
--- a/svtools/source/contnr/treelistbox.cxx
f085be
+++ b/svtools/source/contnr/treelistbox.cxx
f085be
@@ -1301,9 +1301,8 @@ sal_Int8 SvTreeListBox::ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox
f085be
     TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
f085be
     if( aData.HasFormat( SOT_FORMATSTR_ID_TREELISTBOX ))
f085be
     {
f085be
-        ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
f085be
-        if( aData.GetSequence( SOT_FORMATSTR_ID_TREELISTBOX, aSeq ) &&
f085be
-            sizeof(SvLBoxDDInfo) == aSeq.getLength() )
f085be
+        css::uno::Sequence<sal_Int8> aSeq = aData.GetSequence(SOT_FORMATSTR_ID_TREELISTBOX, OUString());
f085be
+        if (sizeof(SvLBoxDDInfo) == aSeq.getLength())
f085be
         {
f085be
             memcpy( &aDDInfo, aSeq.getConstArray(), sizeof(SvLBoxDDInfo) );
f085be
             nRet = rEvt.mnAction;
f085be
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
f085be
index a9e441a..4f33480 100644
f085be
--- a/svtools/source/dialogs/insdlg.cxx
f085be
+++ b/svtools/source/dialogs/insdlg.cxx
f085be
@@ -294,7 +294,7 @@ sal_Bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rDat
f085be
 
f085be
         uno::Any aAny;
f085be
         if( rData.HasFormat( aFlavor ) &&
f085be
-            ( aAny = rData.GetAny( aFlavor ) ).hasValue() )
f085be
+            ( aAny = rData.GetAny(aFlavor, OUString()) ).hasValue() )
f085be
         {
f085be
             uno::Sequence< sal_Int8 > anySequence;
f085be
             aAny >>= anySequence;
f085be
diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx
f085be
index 7ccbfe5..e7a572e 100644
f085be
--- a/svtools/source/misc/embedtransfer.cxx
f085be
+++ b/svtools/source/misc/embedtransfer.cxx
f085be
@@ -65,7 +65,10 @@ SvEmbedTransferHelper::~SvEmbedTransferHelper()
f085be
     }
f085be
 }
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+void SvEmbedTransferHelper::SetParentShellID( const OUString& rShellID )
f085be
+{
f085be
+    maParentShellID = rShellID;
f085be
+}
f085be
 
f085be
 void SvEmbedTransferHelper::AddSupportedFormats()
f085be
 {
f085be
@@ -76,7 +79,8 @@ void SvEmbedTransferHelper::AddSupportedFormats()
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool SvEmbedTransferHelper::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool SvEmbedTransferHelper::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
     sal_Bool bRet = sal_False;
f085be
 
f085be
@@ -109,7 +113,12 @@ sal_Bool SvEmbedTransferHelper::GetData( const ::com::sun::star::datatransfer::D
f085be
                             SvStream* pStream = NULL;
f085be
                             sal_Bool bDeleteStream = sal_False;
f085be
                             uno::Sequence < beans::PropertyValue > aEmpty;
f085be
-                            xPers->storeToEntry( xStg, aName, aEmpty, aEmpty );
f085be
+                            uno::Sequence<beans::PropertyValue> aObjArgs(2);
f085be
+                            aObjArgs[0].Name = "SourceShellID";
f085be
+                            aObjArgs[0].Value <<= maParentShellID;
f085be
+                            aObjArgs[1].Name = "DestinationShellID";
f085be
+                            aObjArgs[1].Value <<= rDestDoc;
f085be
+                            xPers->storeToEntry(xStg, aName, aEmpty, aObjArgs);
f085be
                             if ( xStg->isStreamElement( aName ) )
f085be
                             {
f085be
                                 uno::Reference < io::XStream > xStm = xStg->cloneStreamElement( aName );
f085be
diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx
f085be
index 579a999..687b1a9 100644
f085be
--- a/svtools/source/misc/stringtransfer.cxx
f085be
+++ b/svtools/source/misc/stringtransfer.cxx
f085be
@@ -43,8 +43,7 @@ namespace svt
f085be
         AddFormat(SOT_FORMAT_STRING);
f085be
     }
f085be
 
f085be
-    //--------------------------------------------------------------------
f085be
-    sal_Bool OStringTransferable::GetData( const DataFlavor& _rFlavor )
f085be
+    sal_Bool OStringTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         sal_uInt32 nFormat = SotExchange::GetFormat( _rFlavor );
f085be
         if (SOT_FORMAT_STRING == nFormat)
f085be
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
f085be
index 73537b6..dd5e54c 100644
f085be
--- a/svtools/source/misc/transfer.cxx
f085be
+++ b/svtools/source/misc/transfer.cxx
f085be
@@ -45,6 +45,7 @@
f085be
 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
f085be
 #include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
f085be
 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
f085be
+#include <com/sun/star/datatransfer/XTransferable2.hpp>
f085be
 #include <com/sun/star/frame/Desktop.hpp>
f085be
 #include <com/sun/star/lang/XInitialization.hpp>
f085be
 
f085be
@@ -338,6 +339,12 @@ TransferableHelper::~TransferableHelper()
f085be
 
f085be
 Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) throw( UnsupportedFlavorException, IOException, RuntimeException )
f085be
 {
f085be
+    return getTransferData2(rFlavor, OUString());
f085be
+}
f085be
+
f085be
+Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
+    throw (UnsupportedFlavorException, IOException, RuntimeException)
f085be
+{
f085be
     if( !maAny.hasValue() || !mpFormats->size() || ( maLastFormat != rFlavor.MimeType ) )
f085be
     {
f085be
         const SolarMutexGuard aGuard;
f085be
@@ -358,21 +365,21 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th
f085be
             if( SotExchange::GetFormatDataFlavor( FORMAT_STRING, aSubstFlavor ) &&
f085be
                 TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) )
f085be
             {
f085be
-                GetData( aSubstFlavor );
f085be
+                GetData(aSubstFlavor, rDestDoc);
f085be
                 bDone = maAny.hasValue();
f085be
             }
f085be
             else if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor )
f085be
                 && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor )
f085be
                 && SotExchange::GetFormatDataFlavor(FORMAT_BITMAP, aSubstFlavor))
f085be
             {
f085be
-                GetData( aSubstFlavor );
f085be
-                bDone = sal_True;
f085be
+                GetData(aSubstFlavor, rDestDoc);
f085be
+                bDone = true;
f085be
             }
f085be
             else if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EMF, aSubstFlavor ) &&
f085be
                      TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) &&
f085be
                      SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) )
f085be
             {
f085be
-                GetData( aSubstFlavor );
f085be
+                GetData(aSubstFlavor, rDestDoc);
f085be
 
f085be
                 if( maAny.hasValue() )
f085be
                 {
f085be
@@ -402,7 +409,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th
f085be
                      TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) &&
f085be
                      SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) )
f085be
             {
f085be
-                GetData( aSubstFlavor );
f085be
+                GetData(aSubstFlavor, rDestDoc);
f085be
 
f085be
                 if( maAny.hasValue() )
f085be
                 {
f085be
@@ -435,7 +442,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th
f085be
 
f085be
             // if any is not yet filled, use standard format
f085be
             if( !maAny.hasValue() )
f085be
-                GetData( rFlavor );
f085be
+                GetData(rFlavor, rDestDoc);
f085be
 
f085be
 #ifdef DEBUG
f085be
             if( maAny.hasValue() && ::com::sun::star::uno::TypeClass_STRING != maAny.getValueType().getTypeClass() )
f085be
@@ -1573,13 +1580,13 @@ Reference< XTransferable > TransferableDataHelper::GetXTransferable() const
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-Any TransferableDataHelper::GetAny( SotFormatStringId nFormat ) const
f085be
+Any TransferableDataHelper::GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const
f085be
 {
f085be
     Any aReturn;
f085be
 
f085be
     DataFlavor aFlavor;
f085be
     if ( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) )
f085be
-        aReturn = GetAny( aFlavor );
f085be
+        aReturn = GetAny(aFlavor, rDestDoc);
f085be
 
f085be
     return aReturn;
f085be
 }
f085be
@@ -1587,7 +1594,7 @@ Any TransferableDataHelper::GetAny( SotFormatStringId nFormat ) const
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const
f085be
+Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& rDestDoc ) const
f085be
 {
f085be
     ::osl::MutexGuard aGuard( mpImpl->maMutex );
f085be
     Any aRet;
f085be
@@ -1598,13 +1605,20 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const
f085be
         {
f085be
             const SotFormatStringId         nRequestFormat = SotExchange::GetFormat( rFlavor );
f085be
 
f085be
+            Reference<css::datatransfer::XTransferable2> xTransfer2(mxTransfer, UNO_QUERY);
f085be
+
f085be
             if( nRequestFormat )
f085be
             {
f085be
                 // try to get alien format first
f085be
                 for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
f085be
                 {
f085be
                     if( ( nRequestFormat == (*aIter).mnSotId ) && !rFlavor.MimeType.equalsIgnoreAsciiCase( (*aIter).MimeType ) )
f085be
-                        aRet = mxTransfer->getTransferData( *aIter );
f085be
+                    {
f085be
+                        if (xTransfer2.is())
f085be
+                            aRet = xTransfer2->getTransferData2(*aIter, rDestDoc);
f085be
+                        else
f085be
+                            aRet = mxTransfer->getTransferData(*aIter);
f085be
+                    }
f085be
 
f085be
                     if( aRet.hasValue() )
f085be
                         break;
f085be
@@ -1612,7 +1626,12 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor ) const
f085be
             }
f085be
 
f085be
             if( !aRet.hasValue() )
f085be
-                aRet = mxTransfer->getTransferData( rFlavor );
f085be
+            {
f085be
+                if (xTransfer2.is())
f085be
+                    aRet = xTransfer2->getTransferData2(rFlavor, rDestDoc);
f085be
+                else
f085be
+                    aRet = mxTransfer->getTransferData(rFlavor);
f085be
+            }
f085be
         }
f085be
     }
f085be
     catch( const ::com::sun::star::uno::Exception& )
f085be
@@ -1634,8 +1653,8 @@ sal_Bool TransferableDataHelper::GetString( SotFormatStringId nFormat, OUString&
f085be
 
f085be
 sal_Bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, OUString& rStr )
f085be
 {
f085be
-    Any         aAny( GetAny( rFlavor ) );
f085be
-    sal_Bool    bRet = sal_False;
f085be
+    Any aAny = GetAny(rFlavor, OUString());
f085be
+    bool        bRet = false;
f085be
 
f085be
     if( aAny.hasValue() )
f085be
     {
f085be
@@ -2003,9 +2022,9 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
f085be
 
f085be
         case( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ):
f085be
         {
f085be
-            Sequence< sal_Int8 > aSeq;
f085be
+            Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
f085be
 
f085be
-            if( GetSequence( rFlavor, aSeq ) && ( 2048 == aSeq.getLength() ) )
f085be
+            if (2048 == aSeq.getLength())
f085be
             {
f085be
                 const sal_Char* p1 = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() );
f085be
                 const sal_Char* p2 =  reinterpret_cast< const sal_Char* >( aSeq.getConstArray() ) + 1024;
f085be
@@ -2019,9 +2038,9 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
f085be
 #ifdef WNT
f085be
         case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
f085be
         {
f085be
-            Sequence< sal_Int8 > aSeq;
f085be
+            Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
f085be
 
f085be
-            if( GetSequence( rFlavor, aSeq ) && aSeq.getLength() )
f085be
+            if (aSeq.getLength())
f085be
             {
f085be
                 FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*) aSeq.getConstArray();
f085be
 
f085be
@@ -2041,14 +2060,14 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
f085be
 
f085be
                             aSeq.realloc( 0 );
f085be
                             delete pStream;
f085be
+                            pStream = NULL;
f085be
 
f085be
-                            if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_FILECONTENT, aFileContentFlavor ) &&
f085be
-                                GetSequence( aFileContentFlavor, aSeq ) && aSeq.getLength() )
f085be
+                            if (SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_FILECONTENT, aFileContentFlavor))
f085be
                             {
f085be
-                                pStream = new SvMemoryStream( (sal_Char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_STD_READ );
f085be
+                                aSeq = GetSequence(aFileContentFlavor, OUString());
f085be
+                                if (aSeq.getLength())
f085be
+                                    pStream = new SvMemoryStream( (sal_Char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_STD_READ );
f085be
                             }
f085be
-                            else
f085be
-                                pStream = NULL;
f085be
                         }
f085be
 
f085be
                         if( pStream )
f085be
@@ -2153,70 +2172,70 @@ sal_Bool TransferableDataHelper::GetFileList(
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool TransferableDataHelper::GetSequence( SotFormatStringId nFormat, Sequence< sal_Int8 >& rSeq )
f085be
+
f085be
+Sequence<sal_Int8> TransferableDataHelper::GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc )
f085be
 {
f085be
     DataFlavor aFlavor;
f085be
-    return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSequence( aFlavor, rSeq ) );
f085be
-}
f085be
+    if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor))
f085be
+        return Sequence<sal_Int8>();
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+    return GetSequence(aFlavor, rDestDoc);
f085be
+}
f085be
 
f085be
-sal_Bool TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, Sequence< sal_Int8 >& rSeq )
f085be
+Sequence<sal_Int8> TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
 #ifdef DEBUG
f085be
     fprintf( stderr, "TransferableDataHelper requests sequence of data\n" );
f085be
 #endif
f085be
 
f085be
-    const Any aAny( GetAny( rFlavor ) );
f085be
-    return( aAny.hasValue() && ( aAny >>= rSeq ) );
f085be
-}
f085be
+    const Any aAny = GetAny(rFlavor, rDestDoc);
f085be
+    Sequence<sal_Int8> aSeq;
f085be
+    if (aAny.hasValue())
f085be
+        aAny >>= aSeq;
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+    return aSeq;
f085be
+}
f085be
 
f085be
-sal_Bool TransferableDataHelper::GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rxStream )
f085be
+bool TransferableDataHelper::GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rxStream )
f085be
 {
f085be
     DataFlavor aFlavor;
f085be
     return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) );
f085be
 }
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
-
f085be
-sal_Bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, SotStorageStreamRef& rxStream )
f085be
+bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, SotStorageStreamRef& rxStream )
f085be
 {
f085be
-    Sequence< sal_Int8 >    aSeq;
f085be
-    sal_Bool                bRet = GetSequence( rFlavor, aSeq );
f085be
+    Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
f085be
 
f085be
-    if( bRet )
f085be
+    if (aSeq.getLength())
f085be
     {
f085be
         rxStream = new SotStorageStream( "" );
f085be
         rxStream->Write( aSeq.getConstArray(), aSeq.getLength() );
f085be
         rxStream->Seek( 0 );
f085be
     }
f085be
 
f085be
-    return bRet;
f085be
+    return aSeq.getLength();
f085be
 }
f085be
 
f085be
-sal_Bool TransferableDataHelper::GetInputStream( SotFormatStringId nFormat, Reference < XInputStream >& rxStream )
f085be
+Reference<XInputStream> TransferableDataHelper::GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc )
f085be
 {
f085be
     DataFlavor aFlavor;
f085be
-    return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetInputStream( aFlavor, rxStream ) );
f085be
-}
f085be
+    if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor))
f085be
+        return Reference<XInputStream>();
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+    return GetInputStream(aFlavor, rDestDoc);
f085be
+}
f085be
 
f085be
-sal_Bool TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, Reference < XInputStream >& rxStream )
f085be
+Reference<XInputStream> TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
-    Sequence< sal_Int8 >    aSeq;
f085be
-    sal_Bool                bRet = GetSequence( rFlavor, aSeq );
f085be
+    Sequence<sal_Int8> aSeq = GetSequence(rFlavor, rDestDoc);
f085be
 
f085be
-    if( bRet )
f085be
-          rxStream = new ::comphelper::SequenceInputStream( aSeq );
f085be
+    if (!aSeq.getLength())
f085be
+        return Reference<XInputStream>();
f085be
 
f085be
-    return bRet;
f085be
+    Reference<XInputStream> xStream(new comphelper::SequenceInputStream(aSeq));
f085be
+    return xStream;
f085be
 }
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
-
f085be
 void TransferableDataHelper::Rebind( const Reference< XTransferable >& _rxNewContent )
f085be
 {
f085be
     mxTransfer = _rxNewContent;
f085be
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
f085be
index eb282c1..9c4cc68 100644
f085be
--- a/svtools/source/misc/transfer2.cxx
f085be
+++ b/svtools/source/misc/transfer2.cxx
f085be
@@ -415,8 +415,8 @@ void TransferDataContainer::AddSupportedFormats()
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool TransferDataContainer::GetData( const
f085be
-            ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool TransferDataContainer::GetData(
f085be
+    const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     TDataCntnrEntryList::iterator   aIter( pImpl->aFmtList.begin() ),
f085be
                                     aEnd( pImpl->aFmtList.end() );
f085be
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
f085be
index 3aee208..f0bbd32 100644
f085be
--- a/svx/source/engine3d/view3d.cxx
f085be
+++ b/svx/source/engine3d/view3d.cxx
f085be
@@ -441,7 +441,9 @@ SdrModel* E3dView::GetMarkedObjModel() const
f085be
 // When pasting objects have to integrated if a scene is inserted, but
f085be
 // not the scene itself
f085be
 
f085be
-sal_Bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
f085be
+sal_Bool E3dView::Paste(
f085be
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+    const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
     sal_Bool bRetval = sal_False;
f085be
 
f085be
@@ -486,7 +488,7 @@ sal_Bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLs
f085be
     else
f085be
     {
f085be
         // call parent
f085be
-        bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions);
f085be
+        bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID);
f085be
     }
f085be
 
f085be
     return bRetval;
f085be
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx
f085be
index ff0e74f..01a7845 100644
f085be
--- a/svx/source/fmcomp/dbaexchange.cxx
f085be
+++ b/svx/source/fmcomp/dbaexchange.cxx
f085be
@@ -223,8 +223,7 @@ namespace svx
f085be
             AddFormat(getDescriptorFormatId());
f085be
     }
f085be
 
f085be
-    //--------------------------------------------------------------------
f085be
-    sal_Bool OColumnTransferable::GetData( const DataFlavor& _rFlavor )
f085be
+    sal_Bool OColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
f085be
         switch (nFormatId)
f085be
@@ -276,7 +275,7 @@ namespace svx
f085be
             SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor);
f085be
             OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
f085be
 
f085be
-            Any aDescriptor = _rData.GetAny(aFlavor);
f085be
+            Any aDescriptor = _rData.GetAny(aFlavor, OUString());
f085be
 
f085be
             // extract the property value sequence
f085be
             Sequence< PropertyValue > aDescriptorProps;
f085be
@@ -468,8 +467,7 @@ namespace svx
f085be
             AddFormat(SOT_FORMATSTR_ID_SBA_DATAEXCHANGE);
f085be
     }
f085be
 
f085be
-    // -----------------------------------------------------------------------------
f085be
-    sal_Bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor )
f085be
+    sal_Bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         sal_uIntPtr nFormat = SotExchange::GetFormat(rFlavor);
f085be
         switch (nFormat)
f085be
@@ -524,7 +522,7 @@ namespace svx
f085be
             SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
f085be
             OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
f085be
 
f085be
-            Any aDescriptor = _rData.GetAny(aFlavor);
f085be
+            Any aDescriptor = _rData.GetAny(aFlavor, OUString());
f085be
 
f085be
             // extract the property value sequence
f085be
             Sequence< PropertyValue > aDescriptorProps;
f085be
@@ -643,8 +641,8 @@ namespace svx
f085be
     {
f085be
         AddFormat(getDescriptorFormatId());
f085be
     }
f085be
-    //--------------------------------------------------------------------
f085be
-    sal_Bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor )
f085be
+
f085be
+    sal_Bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
f085be
         if (nFormatId == getDescriptorFormatId())
f085be
@@ -682,7 +680,7 @@ namespace svx
f085be
             SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor);
f085be
             OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
f085be
 
f085be
-            _rData.GetAny(aFlavor) >>= aList;
f085be
+            _rData.GetAny(aFlavor, OUString()) >>= aList;
f085be
         } // if (_rData.HasFormat(getDescriptorFormatId()))
f085be
         return aList;
f085be
     }
f085be
diff --git a/svx/source/fmcomp/dbaobjectex.cxx b/svx/source/fmcomp/dbaobjectex.cxx
f085be
index 2d5be88..3534659 100644
f085be
--- a/svx/source/fmcomp/dbaobjectex.cxx
f085be
+++ b/svx/source/fmcomp/dbaobjectex.cxx
f085be
@@ -89,8 +89,7 @@ namespace svx
f085be
         AddFormat(getDescriptorFormatId(bForm));
f085be
     }
f085be
 
f085be
-    //--------------------------------------------------------------------
f085be
-    sal_Bool OComponentTransferable::GetData( const DataFlavor& _rFlavor )
f085be
+    sal_Bool OComponentTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
f085be
         if ( nFormatId == getDescriptorFormatId(sal_True) || nFormatId == getDescriptorFormatId(sal_False) )
f085be
@@ -131,7 +130,7 @@ namespace svx
f085be
             SotExchange::GetFormatDataFlavor(getDescriptorFormatId(bForm), aFlavor);
f085be
             OSL_ENSURE(bSuccess, "OComponentTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
f085be
 
f085be
-            Any aDescriptor = _rData.GetAny(aFlavor);
f085be
+            Any aDescriptor = _rData.GetAny(aFlavor, OUString());
f085be
 
f085be
             // extract the property value sequence
f085be
             Sequence< PropertyValue > aDescriptorProps;
f085be
diff --git a/svx/source/fmcomp/xmlexchg.cxx b/svx/source/fmcomp/xmlexchg.cxx
f085be
index fecc0e6..fe94b02 100644
f085be
--- a/svx/source/fmcomp/xmlexchg.cxx
f085be
+++ b/svx/source/fmcomp/xmlexchg.cxx
f085be
@@ -43,7 +43,7 @@ namespace svx
f085be
         AddFormat( SOT_FORMATSTR_ID_XFORMS );
f085be
     }
f085be
     //--------------------------------------------------------------------
f085be
-    sal_Bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor )
f085be
+    sal_Bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor );
f085be
         if ( SOT_FORMATSTR_ID_XFORMS == nFormatId )
f085be
diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx
f085be
index c137183..6a074a4 100644
f085be
--- a/svx/source/form/fmexch.cxx
f085be
+++ b/svx/source/form/fmexch.cxx
f085be
@@ -115,7 +115,7 @@ namespace svxform
f085be
     }
f085be
 
f085be
     //--------------------------------------------------------------------
f085be
-    sal_Bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/ )
f085be
+    sal_Bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/, const OUString& /*rDestDoc*/ )
f085be
     {
f085be
         return sal_False;   // do not have any formats by default
f085be
     }
f085be
@@ -139,7 +139,7 @@ namespace svxform
f085be
         if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) )
f085be
         {   // paths to the controls, relative to a root
f085be
             Sequence< Any > aControlPathData;
f085be
-            if ( aExchangedData.GetAny( OControlExchange::getControlPathFormatId() ) >>= aControlPathData )
f085be
+            if ( aExchangedData.GetAny(OControlExchange::getControlPathFormatId(), OUString()) >>= aControlPathData )
f085be
             {
f085be
                 DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" );
f085be
                 if ( aControlPathData.getLength() >= 2 )
f085be
@@ -155,7 +155,7 @@ namespace svxform
f085be
         }
f085be
         if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) )
f085be
         {   // sequence of models of hidden controls
f085be
-            aExchangedData.GetAny( OControlExchange::getHiddenControlModelsFormatId() ) >>= m_aHiddenControlModels;
f085be
+            aExchangedData.GetAny(OControlExchange::getHiddenControlModelsFormatId(), OUString()) >>= m_aHiddenControlModels;
f085be
         }
f085be
 
f085be
         updateFormats( );
f085be
@@ -289,8 +289,7 @@ namespace svxform
f085be
     {
f085be
     }
f085be
 
f085be
-    //--------------------------------------------------------------------
f085be
-    sal_Bool OControlExchange::GetData( const DataFlavor& _rFlavor )
f085be
+    sal_Bool OControlExchange::GetData( const DataFlavor& _rFlavor, const OUString& rDestDoc )
f085be
     {
f085be
         const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor );
f085be
 
f085be
@@ -310,7 +309,7 @@ namespace svxform
f085be
             SetAny( makeAny( m_aHiddenControlModels ), _rFlavor );
f085be
         }
f085be
         else
f085be
-            return OLocalExchange::GetData( _rFlavor );
f085be
+            return OLocalExchange::GetData(_rFlavor, rDestDoc);
f085be
 
f085be
         return sal_True;
f085be
     }
f085be
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
f085be
index 83c6709..3f5b8f1 100644
f085be
--- a/svx/source/form/fmview.cxx
f085be
+++ b/svx/source/form/fmview.cxx
f085be
@@ -379,13 +379,6 @@ SdrModel* FmFormView::GetMarkedObjModel() const
f085be
     return E3dView::GetMarkedObjModel();
f085be
 }
f085be
 
f085be
-//------------------------------------------------------------------------
f085be
-sal_Bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
f085be
-{
f085be
-    return E3dView::Paste(rMod, rPos, pLst, nOptions);
f085be
-}
f085be
-
f085be
-//------------------------------------------------------------------------
f085be
 void FmFormView::ActivateControls(SdrPageView* pPageView)
f085be
 {
f085be
     if (!pPageView)
f085be
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
f085be
index fca950f..8adad0d 100644
f085be
--- a/svx/source/gallery2/galmisc.cxx
f085be
+++ b/svx/source/gallery2/galmisc.cxx
f085be
@@ -512,7 +512,7 @@ void GalleryTransferable::AddSupportedFormats()
f085be
     }
f085be
 }
f085be
 
f085be
-sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
f085be
     sal_Bool    bRet = sal_False;
f085be
diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx
f085be
index e2c9a84..6c59ffb 100644
f085be
--- a/svx/source/inc/fmexch.hxx
f085be
+++ b/svx/source/inc/fmexch.hxx
f085be
@@ -79,7 +79,7 @@ namespace svxform
f085be
 
f085be
         // TransferableHelper
f085be
         virtual void        DragFinished( sal_Int8 nDropAction );
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
 
f085be
     private:
f085be
         void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions, sal_Int32 nDragPointer = DND_POINTER_NONE, sal_Int32 nDragImage = DND_IMAGE_NONE )
f085be
@@ -222,7 +222,7 @@ namespace svxform
f085be
         inline static sal_Bool  hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats );
f085be
 
f085be
     protected:
f085be
-        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+        virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
         virtual void        AddSupportedFormats();
f085be
     };
f085be
 
f085be
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
f085be
index b495c5b..d821757 100644
f085be
--- a/svx/source/svdraw/svdobj.cxx
f085be
+++ b/svx/source/svdraw/svdobj.cxx
f085be
@@ -1064,6 +1064,11 @@ SdrObject* SdrObject::Clone() const
f085be
     return CloneHelper< SdrObject >();
f085be
 }
f085be
 
f085be
+SdrObject* SdrObject::CloneWithShellIDs( const OUString& /*rSrcShellID*/, const OUString& /*rDestShellID*/ ) const
f085be
+{
f085be
+    return Clone();
f085be
+}
f085be
+
f085be
 SdrObject& SdrObject::operator=(const SdrObject& rObj)
f085be
 {
f085be
     if( this == &rObj )
f085be
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
f085be
index 1102de8..f68f5d7 100644
f085be
--- a/svx/source/svdraw/svdoole2.cxx
f085be
+++ b/svx/source/svdraw/svdoole2.cxx
f085be
@@ -1621,7 +1621,20 @@ SdrOle2Obj* SdrOle2Obj::Clone() const
f085be
     return CloneHelper< SdrOle2Obj >();
f085be
 }
f085be
 
f085be
-SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
f085be
+SdrOle2Obj* SdrOle2Obj::CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const
f085be
+{
f085be
+    SdrOle2Obj* pObj =
f085be
+        dynamic_cast<SdrOle2Obj*>(
f085be
+            SdrObjFactory::MakeNewObject(GetObjInventor(), GetObjIdentifier(), NULL));
f085be
+
f085be
+    if (pObj)
f085be
+        pObj->assignFrom(*this, rSrcShellID, rDestShellID);
f085be
+
f085be
+    return pObj;
f085be
+}
f085be
+
f085be
+SdrOle2Obj& SdrOle2Obj::assignFrom(
f085be
+    const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
     //TODO/LATER: who takes over control of my old object?!
f085be
     if( &rObj != this )
f085be
@@ -1668,7 +1681,8 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
f085be
                 if ( xObj.is() )
f085be
                 {
f085be
                     OUString aTmp;
f085be
-                    xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() );
f085be
+                    xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
f085be
+                        rContainer, xObj, aTmp, rSrcShellID, rDestShellID), rOle2Obj.GetAspect());
f085be
                     m_bTypeAsked = false;
f085be
                     mpImpl->aPersistName = aTmp;
f085be
                     CheckFileLink_Impl();
f085be
@@ -1681,7 +1695,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
f085be
     return *this;
f085be
 }
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
f085be
+{
f085be
+    return assignFrom(rObj, OUString(), OUString());
f085be
+}
f085be
 
f085be
 void SdrOle2Obj::ImpSetVisAreaSize()
f085be
 {
f085be
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
f085be
index 374f9a9..fe62e91 100644
f085be
--- a/svx/source/svdraw/svdxcgv.cxx
f085be
+++ b/svx/source/svdraw/svdxcgv.cxx
f085be
@@ -223,7 +223,9 @@ sal_Bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_
f085be
     return sal_True;
f085be
 }
f085be
 
f085be
-sal_Bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
f085be
+sal_Bool SdrExchangeView::Paste(
f085be
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
f085be
+    const OUString& rSrcShellID, const OUString& rDestShellID )
f085be
 {
f085be
     const SdrModel* pSrcMod=&rMod;
f085be
     if (pSrcMod==pMod)
f085be
@@ -298,7 +300,7 @@ sal_Bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjL
f085be
         {
f085be
             const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
f085be
 
f085be
-            SdrObject* pNeuObj = pSrcOb->Clone();
f085be
+            SdrObject* pNeuObj = pSrcOb->CloneWithShellIDs(rSrcShellID, rDestShellID);
f085be
 
f085be
             if (pNeuObj!=NULL)
f085be
             {
f085be
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
f085be
index 9591235..61e5bf1 100644
f085be
--- a/svx/source/tbxctrls/colrctrl.cxx
f085be
+++ b/svx/source/tbxctrls/colrctrl.cxx
f085be
@@ -49,7 +49,7 @@ private:
f085be
 protected:
f085be
 
f085be
     virtual void            AddSupportedFormats();
f085be
-    virtual sal_Bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
f085be
 
f085be
 public:
f085be
@@ -67,7 +67,7 @@ void SvxColorValueSetData::AddSupportedFormats()
f085be
 
f085be
 // -----------------------------------------------------------------------------
f085be
 
f085be
-sal_Bool SvxColorValueSetData::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
f085be
+sal_Bool SvxColorValueSetData::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
f085be
 {
f085be
     sal_Bool bRet = sal_False;
f085be
 
f085be
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
f085be
index 2474312..8c5b6b9 100644
f085be
--- a/sw/source/core/frmedt/fecopy.cxx
f085be
+++ b/sw/source/core/frmedt/fecopy.cxx
f085be
@@ -1509,7 +1509,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
f085be
         // #i50824#
f085be
         // method <lcl_RemoveOleObjsFromSdrModel> replaced by <lcl_ConvertSdrOle2ObjsToSdrGrafObjs>
f085be
         lcl_ConvertSdrOle2ObjsToSdrGrafObjs( pModel );
f085be
-        pView->Paste( *pModel, aPos );
f085be
+        pView->Paste(*pModel, aPos, NULL, 0, OUString(), OUString());
f085be
 
f085be
         sal_uLong nCnt = pView->GetMarkedObjectList().GetMarkCount();
f085be
         if( nCnt )
f085be
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
f085be
index 0941fdb..e905585 100644
f085be
--- a/sw/source/core/ole/ndole.cxx
f085be
+++ b/sw/source/core/ole/ndole.cxx
f085be
@@ -458,7 +458,9 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
f085be
     pPersistShell->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
f085be
         pSrc->GetEmbeddedObjectContainer(),
f085be
         pSrc->GetEmbeddedObjectContainer().GetEmbeddedObject( aOLEObj.aName ),
f085be
-        aNewName );
f085be
+        aNewName,
f085be
+        OUString(),
f085be
+        OUString());
f085be
 
f085be
     SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
f085be
                                     (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl(),
f085be
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
f085be
index f71d3f5..b1a460b 100644
f085be
--- a/sw/source/core/undo/unins.cxx
f085be
+++ b/sw/source/core/undo/unins.cxx
f085be
@@ -460,7 +460,7 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext)
f085be
             // TODO/LATER: Copying through the container would copy the replacement image as well
f085be
             comphelper::EmbeddedObjectContainer aCnt;
f085be
             OUString aName = aCnt.CreateUniqueObjectName();
f085be
-            if ( aCnt.StoreEmbeddedObject( rSwOLE.GetOleRef(), aName, sal_True ) )
f085be
+            if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString()))
f085be
             {
f085be
                 uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
f085be
                 rDoc.Insert( rContext.GetRepeatPaM(),
f085be
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
f085be
index 028e7ba..2b7ee20 100644
f085be
--- a/sw/source/ui/dochdl/swdtflvr.cxx
f085be
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
f085be
@@ -392,7 +392,7 @@ namespace
f085be
     }
f085be
 }
f085be
 
f085be
-sal_Bool SwTransferable::GetData( const DataFlavor& rFlavor )
f085be
+sal_Bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
f085be
 {
f085be
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
f085be
 
f085be
@@ -488,7 +488,7 @@ sal_Bool SwTransferable::GetData( const DataFlavor& rFlavor )
f085be
         if( xObj.is() )
f085be
         {
f085be
             TransferableDataHelper aD( new SvEmbedTransferHelper( xObj, pOLEGraph, nAspect ) );
f085be
-            uno::Any aAny( aD.GetAny( rFlavor ));
f085be
+            uno::Any aAny = aD.GetAny(rFlavor, rDestDoc);
f085be
             if( aAny.hasValue() )
f085be
                 bOK = SetAny( aAny, rFlavor );
f085be
         }
f085be
@@ -1713,7 +1713,13 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
f085be
     else
f085be
         nId = 0;
f085be
 
f085be
-    if( nId && rData.GetInputStream( nId, xStrm ) && xStrm.is() )
f085be
+    if (nId)
f085be
+    {
f085be
+        SwDocShell* pDocSh = rSh.GetDoc()->GetDocShell();
f085be
+        xStrm = rData.GetInputStream(nId, SfxObjectShell::CreateShellID(pDocSh));
f085be
+    }
f085be
+
f085be
+    if (xStrm.is())
f085be
     {
f085be
         // if there is an embedded object, first try if it's a writer object
f085be
         // this will be inserted into the document by using a Reader
f085be
@@ -1780,8 +1786,9 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
f085be
         {
f085be
             if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFmt, aObjDesc ) )
f085be
              {
f085be
-                if ( !rData.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStrm ) )
f085be
-                    rData.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStrm );
f085be
+                xStrm = rData.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
f085be
+                if (!xStrm.is())
f085be
+                    xStrm = rData.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
f085be
 
f085be
                 if ( !xStrm.is() )
f085be
                 {
f085be
diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx
f085be
index 0b30053..e03625e 100644
f085be
--- a/sw/source/ui/inc/swdtflvr.hxx
f085be
+++ b/sw/source/ui/inc/swdtflvr.hxx
f085be
@@ -138,7 +138,7 @@ class SW_DLLPUBLIC SwTransferable : public TransferableHelper
f085be
 
f085be
 protected:
f085be
     virtual void        AddSupportedFormats();
f085be
-    virtual sal_Bool    GetData( const css::datatransfer::DataFlavor& rFlavor );
f085be
+    virtual sal_Bool    GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
f085be
     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm,
f085be
                                         void* pUserObject,
f085be
                                         sal_uInt32 nUserObjectId,
f085be
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
f085be
index 1647e33..1ffd3c6 100644
f085be
--- a/xmloff/source/chart/SchXMLExport.cxx
f085be
+++ b/xmloff/source/chart/SchXMLExport.cxx
f085be
@@ -268,6 +268,9 @@ public:
f085be
 
f085be
     OUString msCLSID;
f085be
 
f085be
+    OUString maSrcShellID;
f085be
+    OUString maDestShellID;
f085be
+
f085be
     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
f085be
 
f085be
     tDataSequenceCont m_aDataSequencesToExport;
f085be
@@ -1009,6 +1012,16 @@ const OUString& SchXMLExportHelper::getChartCLSID()
f085be
     return m_pImpl->msCLSID;
f085be
 }
f085be
 
f085be
+void SchXMLExportHelper::SetSourceShellID( const OUString& rShellID )
f085be
+{
f085be
+    m_pImpl->maSrcShellID = rShellID;
f085be
+}
f085be
+
f085be
+void SchXMLExportHelper::SetDestinationShellID( const OUString& rShellID )
f085be
+{
f085be
+    m_pImpl->maDestShellID = rShellID;
f085be
+}
f085be
+
f085be
 UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const
f085be
 {
f085be
     return mxPropertySetMapper;
f085be
@@ -2297,6 +2310,32 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis > xChart2Axis, SvXMLExpo
f085be
     return bExportDateScale;
f085be
 }
f085be
 
f085be
+void disableLinkedNumberFormat(
f085be
+    std::vector<XMLPropertyState>& rPropStates, const UniReference<XMLPropertySetMapper>& rMapper )
f085be
+{
f085be
+    for (size_t i = 0; i < rPropStates.size(); ++i)
f085be
+    {
f085be
+        XMLPropertyState& rState = rPropStates[i];
f085be
+        if (rState.mnIndex < 0 || rMapper->GetEntryCount() <= rState.mnIndex)
f085be
+            continue;
f085be
+
f085be
+        OUString aXMLName = rMapper->GetEntryXMLName(rState.mnIndex);
f085be
+
f085be
+        if (aXMLName != "link-data-style-to-source")
f085be
+            continue;
f085be
+
f085be
+        // Entry found.  Set the value to false and bail out.
f085be
+        rState.maValue <<= false;
f085be
+        return;
f085be
+    }
f085be
+
f085be
+    // Entry not found.  Insert a new entry for this.
f085be
+    sal_Int32 nIndex = rMapper->GetEntryIndex(XML_NAMESPACE_CHART, "link-data-style-to-source", 0);
f085be
+    XMLPropertyState aState(nIndex);
f085be
+    aState.maValue <<= false;
f085be
+    rPropStates.push_back(aState);
f085be
+}
f085be
+
f085be
 }
f085be
 
f085be
 void SchXMLExportHelper_Impl::exportAxis(
f085be
@@ -2317,6 +2356,14 @@ void SchXMLExportHelper_Impl::exportAxis(
f085be
     {
f085be
         lcl_exportNumberFormat( sNumFormat, xAxisProps, mrExport );
f085be
         aPropertyStates = mxExpPropMapper->Filter( xAxisProps );
f085be
+
f085be
+        if (!maSrcShellID.isEmpty() && !maDestShellID.isEmpty() && maSrcShellID != maDestShellID)
f085be
+        {
f085be
+            // Disable link to source number format property when pasting to
f085be
+            // a different doc shell.  These shell ID's should be both empty
f085be
+            // during real ODF export.
f085be
+            disableLinkedNumberFormat(aPropertyStates, mxExpPropMapper->getPropertySetMapper());
f085be
+        }
f085be
     }
f085be
 
f085be
     bool bExportDateScale = false;
f085be
@@ -3556,6 +3603,9 @@ SchXMLExport::~SchXMLExport()
f085be
 
f085be
 sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
f085be
 {
f085be
+    maExportHelper.SetSourceShellID(GetSourceShellID());
f085be
+    maExportHelper.SetDestinationShellID(GetDestinationShellID());
f085be
+
f085be
     Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
f085be
     maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
f085be
     return SvXMLExport::exportDoc( eClass );
f085be
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
f085be
index 3459747..f91d921 100644
f085be
--- a/xmloff/source/core/xmlexp.cxx
f085be
+++ b/xmloff/source/core/xmlexp.cxx
f085be
@@ -257,6 +257,9 @@ public:
f085be
     /// name of stream in package, e.g., "content.xml"
f085be
     OUString mStreamName;
f085be
 
f085be
+    OUString maSrcShellID;
f085be
+    OUString maDestShellID;
f085be
+
f085be
     /// stack of backed up namespace maps
f085be
     /// long: depth at which namespace map has been backed up into the stack
f085be
     ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
f085be
@@ -794,15 +797,16 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
f085be
 
f085be
     try
f085be
     {
f085be
+        const sal_Int32 nPropCount = aDescriptor.getLength();
f085be
+
f085be
         const sal_uInt32 nTest =
f085be
             EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS;
f085be
         if( (mnExportFlags & nTest) == nTest && msOrigFileName.isEmpty() )
f085be
         {
f085be
             // evaluate descriptor only for flat files and if a base URI
f085be
             // has not been provided already
f085be
-            const sal_Int32 nPropCount = aDescriptor.getLength();
f085be
-            const beans::PropertyValue* pProps = aDescriptor.getConstArray();
f085be
 
f085be
+            const beans::PropertyValue* pProps = aDescriptor.getConstArray();
f085be
             for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ )
f085be
             {
f085be
                 const OUString& rPropName = pProps->Name;
f085be
@@ -821,6 +825,25 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
f085be
             }
f085be
         }
f085be
 
f085be
+        const beans::PropertyValue* pProps = aDescriptor.getConstArray();
f085be
+        for (sal_Int32 nIndex = 0; nIndex < nPropCount; ++nIndex, ++pProps)
f085be
+        {
f085be
+            const OUString& rPropName = pProps->Name;
f085be
+            const Any& rValue = pProps->Value;
f085be
+
f085be
+            if (rPropName == "SourceShellID")
f085be
+            {
f085be
+                if (!(rValue >>= mpImpl->maSrcShellID))
f085be
+                    return false;
f085be
+            }
f085be
+            else if (rPropName == "DestinationShellID")
f085be
+            {
f085be
+                if (!(rValue >>= mpImpl->maDestShellID))
f085be
+                    return false;
f085be
+            }
f085be
+        }
f085be
+
f085be
+
f085be
         exportDoc( meClass );
f085be
     }
f085be
     catch(const uno::Exception& e)
f085be
@@ -1510,6 +1533,16 @@ void SvXMLExport::ResetNamespaceMap()
f085be
     delete mpNamespaceMap;    mpNamespaceMap = new SvXMLNamespaceMap;
f085be
 }
f085be
 
f085be
+OUString SvXMLExport::GetSourceShellID() const
f085be
+{
f085be
+    return mpImpl->maSrcShellID;
f085be
+}
f085be
+
f085be
+OUString SvXMLExport::GetDestinationShellID() const
f085be
+{
f085be
+    return mpImpl->maDestShellID;
f085be
+}
f085be
+
f085be
 void SvXMLExport::_ExportMeta()
f085be
 {
f085be
     OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );
f085be
-- 
f085be
1.9.3
f085be