[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - chart2/source comphelper/source dbaccess/source embeddedobj/source include/comphelper include/sfx2 include/svtools include/svx include/xmloff offapi/com offapi/UnoApi_offapi.mk reportdesign/source sc/inc sc/source sd/source sfx2/source starmath/source svtools/source svx/source sw/source xmloff/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Jun 23 08:02:39 PDT 2014


 chart2/source/controller/chartapiwrapper/AxisWrapper.cxx                 |    5 
 chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx      |    5 
 chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx |   67 ------
 chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx |    9 
 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx            |    7 
 chart2/source/controller/main/ChartDropTargetHelper.cxx                  |    4 
 chart2/source/controller/main/ChartTransferable.cxx                      |    2 
 chart2/source/controller/main/ChartTransferable.hxx                      |    2 
 chart2/source/model/filter/XMLFilter.cxx                                 |    5 
 chart2/source/model/inc/XMLFilter.hxx                                    |    3 
 chart2/source/model/main/Axis.cxx                                        |   15 +
 chart2/source/model/main/DataPointProperties.cxx                         |   11 -
 chart2/source/model/main/DataPointProperties.hxx                         |    1 
 chart2/source/model/template/ChartTypeTemplate.cxx                       |   10 
 chart2/source/tools/AxisHelper.cxx                                       |   15 +
 chart2/source/view/main/ChartView.cxx                                    |   15 +
 comphelper/source/container/embeddedobjectcontainer.cxx                  |   21 +
 dbaccess/source/ui/browser/dbexchange.cxx                                |    4 
 dbaccess/source/ui/inc/JoinExchange.hxx                                  |    2 
 dbaccess/source/ui/inc/TableRowExchange.hxx                              |    2 
 dbaccess/source/ui/inc/dbexchange.hxx                                    |    2 
 dbaccess/source/ui/querydesign/JoinExchange.cxx                          |    2 
 dbaccess/source/ui/tabledesign/TableRowExchange.cxx                      |    2 
 embeddedobj/source/commonembedding/persistence.cxx                       |   52 +++-
 embeddedobj/source/inc/commonembobj.hxx                                  |   12 -
 include/comphelper/embeddedobjectcontainer.hxx                           |    8 
 include/sfx2/objsh.hxx                                                   |    2 
 include/svtools/embedtransfer.hxx                                        |    6 
 include/svtools/stringtransfer.hxx                                       |    4 
 include/svtools/transfer.hxx                                             |   25 +-
 include/svx/dbaexchange.hxx                                              |    6 
 include/svx/dbaobjectex.hxx                                              |    2 
 include/svx/fmview.hxx                                                   |    2 
 include/svx/galmisc.hxx                                                  |    2 
 include/svx/svdobj.hxx                                                   |    3 
 include/svx/svdoole2.hxx                                                 |    5 
 include/svx/svdxcgv.hxx                                                  |    5 
 include/svx/view3d.hxx                                                   |    4 
 include/svx/xmlexchg.hxx                                                 |    2 
 include/xmloff/SchXMLExportHelper.hxx                                    |    3 
 include/xmloff/xmlexp.hxx                                                |    3 
 offapi/UnoApi_offapi.mk                                                  |    1 
 offapi/com/sun/star/datatransfer/XTransferable2.idl                      |   41 +++
 reportdesign/source/ui/dlg/GroupExchange.cxx                             |    2 
 reportdesign/source/ui/dlg/GroupExchange.hxx                             |    2 
 reportdesign/source/ui/dlg/GroupsSorting.cxx                             |    4 
 reportdesign/source/ui/inc/dlgedclip.hxx                                 |    2 
 reportdesign/source/ui/report/dlgedclip.cxx                              |    4 
 sc/inc/column.hxx                                                        |    6 
 sc/inc/document.hxx                                                      |    1 
 sc/inc/table.hxx                                                         |    6 
 sc/source/core/data/column.cxx                                           |   14 +
 sc/source/core/data/document.cxx                                         |    6 
 sc/source/core/data/table2.cxx                                           |    5 
 sc/source/ui/app/drwtrans.cxx                                            |   52 +++-
 sc/source/ui/app/lnktrans.cxx                                            |    3 
 sc/source/ui/app/seltrans.cxx                                            |    5 
 sc/source/ui/app/transobj.cxx                                            |    2 
 sc/source/ui/inc/drwtrans.hxx                                            |    7 
 sc/source/ui/inc/lnktrans.hxx                                            |    2 
 sc/source/ui/inc/seltrans.hxx                                            |    2 
 sc/source/ui/inc/transobj.hxx                                            |    2 
 sc/source/ui/inc/viewfunc.hxx                                            |    4 
 sc/source/ui/view/gridwin.cxx                                            |    8 
 sc/source/ui/view/viewfun3.cxx                                           |   11 -
 sc/source/ui/view/viewfun5.cxx                                           |   22 +-
 sc/source/ui/view/viewfun7.cxx                                           |    6 
 sd/source/core/drawdoc3.cxx                                              |    2 
 sd/source/ui/app/sdxfer.cxx                                              |    4 
 sd/source/ui/dlg/sdtreelb.cxx                                            |    2 
 sd/source/ui/inc/TabControl.hxx                                          |    2 
 sd/source/ui/inc/View.hxx                                                |    5 
 sd/source/ui/inc/sdtreelb.hxx                                            |    2 
 sd/source/ui/inc/sdxfer.hxx                                              |    2 
 sd/source/ui/view/sdview2.cxx                                            |    6 
 sd/source/ui/view/sdview3.cxx                                            |   29 +-
 sd/source/ui/view/tabcontr.cxx                                           |    2 
 sfx2/source/doc/objxtor.cxx                                              |   17 +
 starmath/source/view.cxx                                                 |    6 
 svtools/source/contnr/treelistbox.cxx                                    |    5 
 svtools/source/dialogs/insdlg.cxx                                        |    2 
 svtools/source/misc/embedtransfer.cxx                                    |   13 +
 svtools/source/misc/stringtransfer.cxx                                   |    2 
 svtools/source/misc/transfer.cxx                                         |  110 ++++++----
 svtools/source/misc/transfer2.cxx                                        |    4 
 svx/source/engine3d/view3d.cxx                                           |    6 
 svx/source/fmcomp/dbaexchange.cxx                                        |   12 -
 svx/source/fmcomp/dbaobjectex.cxx                                        |    4 
 svx/source/fmcomp/xmlexchg.cxx                                           |    2 
 svx/source/form/fmexch.cxx                                               |   10 
 svx/source/form/fmview.cxx                                               |    7 
 svx/source/gallery2/galmisc.cxx                                          |    2 
 svx/source/inc/fmexch.hxx                                                |    4 
 svx/source/svdraw/svdobj.cxx                                             |    5 
 svx/source/svdraw/svdoole2.cxx                                           |   23 +-
 svx/source/svdraw/svdxcgv.cxx                                            |    6 
 svx/source/tbxctrls/colrctrl.cxx                                         |    4 
 sw/source/core/frmedt/fecopy.cxx                                         |    2 
 sw/source/core/ole/ndole.cxx                                             |    4 
 sw/source/core/uibase/dochdl/swdtflvr.cxx                                |   17 +
 sw/source/core/uibase/inc/swdtflvr.hxx                                   |    2 
 sw/source/core/undo/unins.cxx                                            |    2 
 xmloff/source/chart/SchXMLExport.cxx                                     |   50 ++++
 xmloff/source/core/xmlexp.cxx                                            |   37 +++
 104 files changed, 669 insertions(+), 322 deletions(-)

New commits:
commit 22cd19eeeb476c40b68bb1ff040fce6103fdeba4
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Jun 13 11:12:50 2014 -0400

    fdo#71076, fdo#71767: Preserve number formats when charts are copied.
    
    (cherry picked from commit 1d38cb365543924f9c50014e6b2227e77de1d0c9)
    
    Conflicts:
    	sd/source/ui/view/sdview3.cxx
    	xmloff/source/chart/SchXMLExport.cxx
    
    Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
    Reviewed-on: https://gerrit.libreoffice.org/9836
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
index 2c10c61..4643d6c 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -656,9 +656,8 @@ const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties()
     aWrappedProperties.push_back( new WrappedProperty("Visible","Show") );
     aWrappedProperties.push_back( new WrappedDirectStateProperty("DisplayLabels","DisplayLabels") );
     aWrappedProperties.push_back( new WrappedDirectStateProperty("TextBreak","TextBreak") );
-    WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
-    aWrappedProperties.push_back( pWrappedNumberFormatProperty );
-    aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+    aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) );
+    aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
     aWrappedProperties.push_back( new WrappedProperty("StackedText","StackCharacters") );
     aWrappedProperties.push_back( new WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") );
     {
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index b2429b6..f3c150e 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -701,9 +701,8 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
         WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
         aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
 
-        WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
-        aWrappedProperties.push_back( pWrappedNumberFormatProperty );
-        aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+        aWrappedProperties.push_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) );
+        aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
     }
 
     WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
index 198dc0c..85d8e7e 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -33,18 +33,11 @@ namespace wrapper
 WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
         : WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, CHART_UNONAME_NUMFMT )
         , m_spChart2ModelContact(spChart2ModelContact)
-        , m_pWrappedLinkNumberFormatProperty(NULL)
 {
-    m_aOuterValue = getPropertyDefault( 0 );
 }
 
 WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
 {
-    if( m_pWrappedLinkNumberFormatProperty )
-    {
-        if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty == this )
-            m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty = 0;
-    }
 }
 
 void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -54,19 +47,8 @@ void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, cons
     if( ! (rOuterValue >>= nFormat) )
         throw lang::IllegalArgumentException( "Property 'NumberFormat' requires value of type sal_Int32", 0, 0 );
 
-    m_aOuterValue = rOuterValue;
     if(xInnerPropertySet.is())
-    {
-        bool bUseSourceFormat = !xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
-        if( bUseSourceFormat )
-        {
-            uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
-            if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
-                bUseSourceFormat = false;
-        }
-        if( !bUseSourceFormat )
-            xInnerPropertySet->setPropertyValue( m_aInnerName, this->convertOuterToInnerValue( rOuterValue ) );
-    }
+        xInnerPropertySet->setPropertyValue(getInnerName(), this->convertOuterToInnerValue(rOuterValue));
 }
 
 Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -77,7 +59,7 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp
         OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
         return Any();
     }
-    Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
+    Any aRet( xInnerPropertySet->getPropertyValue(getInnerName()));
     if( !aRet.hasValue() )
     {
         sal_Int32 nKey = 0;
@@ -100,23 +82,14 @@ Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPr
     return uno::makeAny( sal_Int32( 0 ) );
 }
 
-WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty ) :
-    WrappedProperty( CHART_UNONAME_LINK_TO_SRC_NUMFMT, OUString() ),
-    m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty )
+WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) :
+    WrappedDirectStateProperty(CHART_UNONAME_LINK_TO_SRC_NUMFMT, CHART_UNONAME_LINK_TO_SRC_NUMFMT),
+    m_pChart2ModelContact(pChart2ModelContact)
 {
-    if( m_pWrappedNumberFormatProperty )
-    {
-        m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = this;
-    }
 }
 
 WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
 {
-    if( m_pWrappedNumberFormatProperty )
-    {
-        if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty == this )
-            m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 0;
-    }
 }
 
 void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -128,31 +101,7 @@ void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue,
         return;
     }
 
-    bool bLinkFormat = false;
-    if( rOuterValue >>= bLinkFormat )
-    {
-        Any aValue;
-        if( bLinkFormat )
-        {
-            if( m_pWrappedNumberFormatProperty )
-            {
-                uno::Reference< chart2::XChartDocument > xChartDoc( m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() );
-                if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
-                    return;
-            }
-        }
-        else
-        {
-            if( m_pWrappedNumberFormatProperty )
-            {
-                aValue = m_pWrappedNumberFormatProperty->getPropertyValue( xInnerPropertySet );
-            }
-            else
-                aValue <<= sal_Int32( 0 );
-        }
-
-        xInnerPropertySet->setPropertyValue(CHART_UNONAME_NUMFMT, aValue);
-    }
+    xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue);
 }
 
 Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -163,8 +112,8 @@ Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::X
         OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
         return getPropertyDefault(0);
     }
-    bool bLink = ! xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
-    return uno::makeAny( bLink );
+
+    return xInnerPropertySet->getPropertyValue(getInnerName());
 }
 
 Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
index 618fc07..d721e6b 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -49,14 +49,12 @@ public:
     friend class WrappedLinkNumberFormatProperty;
 private:
     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
-    mutable ::com::sun::star::uno::Any m_aOuterValue;
-    WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty;
 };
 
-class WrappedLinkNumberFormatProperty : public WrappedProperty
+class WrappedLinkNumberFormatProperty : public WrappedDirectStateProperty
 {
 public:
-    WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty );
+    WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact );
     virtual ~WrappedLinkNumberFormatProperty();
 
     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
@@ -68,9 +66,8 @@ public:
     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
 
-    friend class WrappedNumberFormatProperty;
 private:
-    WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty;
+    boost::shared_ptr<Chart2ModelContact> m_pChart2ModelContact;
 };
 
 } //namespace wrapper
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index fe8eeb5..e3b7175 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -423,8 +423,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
 
         case SID_ATTR_NUMBERFORMAT_SOURCE:
         {
-            bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue());
-            rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
+            bool bLinkToSource = true;
+            GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
+            rOutItemSet.Put(SfxBoolItem(nWhichId, bLinkToSource));
         }
         break;
 
@@ -930,6 +931,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
             bool bUseSourceFormat =
                 (static_cast< const SfxBoolItem & >(
                     rItemSet.Get( nWhichId )).GetValue() );
+            GetPropertySet()->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(bUseSourceFormat));
+
             bool bNumberFormatIsSet = GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
 
             bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx
index 154db84..0857de3 100644
--- a/chart2/source/controller/main/ChartDropTargetHelper.cxx
+++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx
@@ -103,8 +103,8 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
         TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
         if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK ))
         {
-            Sequence< sal_Int8 > aBytes;
-            if( aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aBytes ))
+            Sequence<sal_Int8> aBytes = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString());
+            if (aBytes.getLength())
             {
                 ::std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes ));
                 if( aStrings.size() >= 3 && aStrings[0] == "soffice" )
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 20f46ac..e46796e 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -73,7 +73,7 @@ void ChartTransferable::AddSupportedFormats()
     AddFormat( SOT_FORMAT_BITMAP );
 }
 
-bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
 {
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
     bool        bResult = false;
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
index b3c3815..3c54689 100644
--- a/chart2/source/controller/main/ChartTransferable.hxx
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -43,7 +43,7 @@ protected:
 
     // implementation of TransferableHelper methods
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
 
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index bc5f494..a5984ede 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -541,6 +541,7 @@ sal_Int32 XMLFilter::impl_Export(
     const Reference< lang::XComponent > & xDocumentComp,
     const Sequence< beans::PropertyValue > & rMediaDescriptor )
 {
+    m_aMediaDescriptor = rMediaDescriptor;
     //save
 
     sal_Int32 nWarning = 0;
@@ -744,9 +745,7 @@ sal_Int32 XMLFilter::impl_ExportStream(
         if ( !xFilter.is() )
             return ERRCODE_SFX_GENERAL;
 
-        uno::Sequence < beans::PropertyValue > aMediaDesc(0);
-        //@todo? filter properties? ... url? ...
-        xFilter->filter( aMediaDesc );
+        xFilter->filter(m_aMediaDescriptor);
     }
     catch (const uno::Exception& rEx)
     {
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
index ad316d0..4c2c8a1 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -151,6 +151,9 @@ private:
         ::com::sun::star::lang::XComponent >       m_xTargetDoc;
     ::com::sun::star::uno::Reference<
         ::com::sun::star::lang::XComponent >       m_xSourceDoc;
+
+    css::uno::Sequence<css::beans::PropertyValue> m_aMediaDescriptor;
+
     OUString                                m_sDocumentHandler; // when set it will be set as doc handler
 
     volatile bool                                  m_bCancelOperation;
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index d09ea4f..df6354c 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -67,7 +67,8 @@ enum
     PROP_AXIS_CROSSOVER_POSITION,
     PROP_AXIS_CROSSOVER_VALUE,
     PROP_AXIS_DISPLAY_LABELS,
-    PROP_AXIS_NUMBER_FORMAT,
+    PROP_AXIS_NUMBERFORMAT,
+    PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
     PROP_AXIS_LABEL_POSITION,
     PROP_AXIS_TEXT_ROTATION,
     PROP_AXIS_TEXT_BREAK,
@@ -115,10 +116,17 @@ void lcl_AddPropertiesToVector(
 
     rOutProperties.push_back(
         Property( CHART_UNONAME_NUMFMT,
-                  PROP_AXIS_NUMBER_FORMAT,
+                  PROP_AXIS_NUMBERFORMAT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID ));
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+    rOutProperties.push_back(
+        Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
+                  PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+                  ::getBooleanCppuType(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
         Property( "LabelPosition",
@@ -220,6 +228,7 @@ private:
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
+        ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
         ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index 2ebfa95..e145d42 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -282,7 +282,14 @@ void DataPointProperties::AddPropertiesToVector(
                   PROP_DATAPOINT_NUMBER_FORMAT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID ));
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+    rOutProperties.push_back(
+        Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
+                  PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
+                  ::getBooleanCppuType(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     //additional 'PercentageNumberFormat'
     rOutProperties.push_back(
@@ -410,6 +417,8 @@ void DataPointProperties::AddDefaultsToMap(
     PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
 
     PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
+
+    PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, true);
 }
 
 } //  namespace chart
diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx
index 596adf8..2d7258a 100644
--- a/chart2/source/model/main/DataPointProperties.hxx
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -62,6 +62,7 @@ public:
         PROP_DATAPOINT_LABEL,
         PROP_DATAPOINT_LABEL_SEPARATOR,
         PROP_DATAPOINT_NUMBER_FORMAT,
+        PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
         PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
         PROP_DATAPOINT_LABEL_PLACEMENT,
         PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index b19ae3f..f764223 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -463,9 +463,8 @@ void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram
                 if( xAxisProp.is())
                 {
                     // set number format to source format
-                    uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT);
-                    if( aValue.hasValue())
-                        xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
+                    xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true));
+                    xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
                 }
             }
         }
@@ -763,9 +762,8 @@ void ChartTypeTemplate::adaptAxes(
                             if( xAxisProp.is())
                             {
                                 // set number format to source format
-                                uno::Any aValue = xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT);
-                                if( aValue.hasValue())
-                                    xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
+                                xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::makeAny(true));
+                                xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
                             }
                         }
                     }
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 9656ad0..e659e81 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -145,7 +145,16 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
     Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
 
     Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
-    if( xProp.is() && !( xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey ) )
+    if (!xProp.is())
+        return 0;
+
+    bool bLinkToSource = true;
+    xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
+    xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
+
+    sal_Int32 nOldNumberFormat = nNumberFormatKey;
+
+    if (bLinkToSource)
     {
         bool bFormatSet = false;
         //check whether we have a percent scale -> use percent format
@@ -318,7 +327,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
                 }
             }
         }
+
+        if (nOldNumberFormat != nNumberFormatKey)
+            xProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nNumberFormatKey));
     }
+
     return nNumberFormatKey;
 }
 
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 9822499..c0bd9009 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1818,7 +1818,16 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
     if( !xSeriesOrPointProp.is() )
         return nFormat;
 
-    if (!(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat))
+    bool bLinkToSource = true;
+    try
+    {
+        xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
+    }
+    catch ( const beans::UnknownPropertyException& ) {}
+
+    xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat;
+    sal_Int32 nOldFormat = nFormat;
+    if (bLinkToSource)
     {
         uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
 
@@ -1843,7 +1852,11 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
                     nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex );
             }
         }
+
+        if (nFormat >= 0 && nOldFormat != nFormat)
+            xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nFormat));
     }
+
     if(nFormat<0)
         nFormat=0;
     return nFormat;
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 50a304b..9437893 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -487,7 +487,9 @@ void EmbeddedObjectContainer::AddEmbeddedObject( const ::com::sun::star::uno::Re
     }
 }
 
-bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, bool bCopy )
+bool EmbeddedObjectContainer::StoreEmbeddedObject(
+    const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName, bool bCopy,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
     uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
     if ( rName.isEmpty() )
@@ -506,7 +508,14 @@ bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed:
         {
             uno::Sequence < beans::PropertyValue > aSeq;
             if ( bCopy )
-                xPersist->storeToEntry( pImpl->mxStorage, rName, aSeq, aSeq );
+            {
+                uno::Sequence<beans::PropertyValue> aObjArgs(2);
+                aObjArgs[0].Name = "SourceShellID";
+                aObjArgs[0].Value <<= rSrcShellID;
+                aObjArgs[1].Name = "DestinationShellID";
+                aObjArgs[1].Value <<= rDestShellID;
+                xPersist->storeToEntry(pImpl->mxStorage, rName, aSeq, aObjArgs);
+            }
             else
             {
                 //TODO/LATER: possible optimization, don't store immediately
@@ -529,7 +538,7 @@ bool EmbeddedObjectContainer::StoreEmbeddedObject( const uno::Reference < embed:
 bool EmbeddedObjectContainer::InsertEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName )
 {
     // store it into the container storage
-    if ( StoreEmbeddedObject( xObj, rName, false ) )
+    if (StoreEmbeddedObject(xObj, rName, false, OUString(), OUString()))
     {
         // remember object
         AddEmbeddedObject( xObj, rName );
@@ -683,7 +692,9 @@ bool EmbeddedObjectContainer::TryToCopyGraphReplacement( EmbeddedObjectContainer
     return bResult;
 }
 
-uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const uno::Reference < embed::XEmbeddedObject >& xObj, OUString& rName )
+uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmbeddedObject(
+    EmbeddedObjectContainer& rSrc, const uno::Reference <embed::XEmbeddedObject>& xObj, OUString& rName,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
     uno::Reference< embed::XEmbeddedObject > xResult;
 
@@ -703,7 +714,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
         rName = CreateUniqueObjectName();
 
     // objects without persistence are not really stored by the method
-    if ( xObj.is() && StoreEmbeddedObject( xObj, rName, true ) )
+    if (xObj.is() && StoreEmbeddedObject(xObj, rName, true, rSrcShellID, rDestShellID))
     {
         xResult = Get_Impl( rName, xObj);
         if ( !xResult.is() )
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index e2cdbbb..616f504 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -159,7 +159,7 @@ namespace dbaui
         ODataAccessObjectTransferable::AddSupportedFormats();
     }
 
-    bool ODataClipboard::GetData( const DataFlavor& rFlavor )
+    bool ODataClipboard::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
     {
         const sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
         switch (nFormat)
@@ -175,7 +175,7 @@ namespace dbaui
                 return m_pHtml.is() && SetObject( m_pHtml.get(), SOT_FORMATSTR_ID_HTML, rFlavor );
         }
 
-        return ODataAccessObjectTransferable::GetData( rFlavor );
+        return ODataAccessObjectTransferable::GetData(rFlavor, rDestDoc);
     }
 
     void ODataClipboard::ObjectReleased()
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
index c343442..448a8c7 100644
--- a/dbaccess/source/ui/inc/JoinExchange.hxx
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -61,7 +61,7 @@ namespace dbaui
 
     protected:
         virtual void                AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void                DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
 
         static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx
index 4e6c0f7..0f49ee4 100644
--- a/dbaccess/source/ui/inc/TableRowExchange.hxx
+++ b/dbaccess/source/ui/inc/TableRowExchange.hxx
@@ -34,7 +34,7 @@ namespace dbaui
         OTableRowExchange(const ::std::vector< ::boost::shared_ptr<OTableRow> >& _rvTableRow);
     protected:
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
         virtual void        ObjectReleased() SAL_OVERRIDE;
     };
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index f2dab76..fa2d9be 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -77,7 +77,7 @@ namespace dbaui
 
     protected:
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void        ObjectReleased() SAL_OVERRIDE;
         virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     };
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index 12b5dcd..e2531a5 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -113,7 +113,7 @@ namespace dbaui
             AddFormat( SOT_FORMATSTR_ID_SBA_TABID );
     }
 
-    bool OJoinExchObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+    bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
     {
         sal_uInt32 nFormat = SotExchange::GetFormat(rFlavor);
         if ( SOT_FORMATSTR_ID_SBA_JOIN == nFormat )
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index 5c3d1c6..e2acae6 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -52,7 +52,7 @@ namespace dbaui
         if ( !m_vTableRow.empty() )
             AddFormat(SOT_FORMATSTR_ID_SBA_TABED);
     }
-    bool OTableRowExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+    bool OTableRowExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
     {
         sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
         if(nFormat == SOT_FORMATSTR_ID_SBA_TABED)
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 4d2ddc8..51210a7 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -723,12 +723,33 @@ void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< docum
         m_xRecoveryStorage.clear();
 }
 
+namespace {
 
-void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage,
-                                                    sal_Int32 nStorageFormat,
-                                                    const OUString& aBaseURL,
-                                                    const OUString& aHierarchName,
-                                                    bool bAttachToTheStorage )
+OUString getStringPropertyValue( const uno::Sequence<beans::PropertyValue>& rProps, const OUString& rName )
+{
+    OUString aStr;
+
+    for (sal_Int32 i = 0; i < rProps.getLength(); ++i)
+    {
+        if (rProps[i].Name == rName)
+        {
+            rProps[i].Value >>= aStr;
+            break;
+        }
+    }
+
+    return aStr;
+}
+
+}
+
+void OCommonEmbeddedObject::StoreDocToStorage_Impl(
+    const uno::Reference<embed::XStorage>& xStorage,
+    const uno::Sequence<beans::PropertyValue>& rMediaArgs,
+    const uno::Sequence<beans::PropertyValue>& rObjArgs,
+    sal_Int32 nStorageFormat,
+    const OUString& aHierarchName,
+    bool bAttachToTheStorage )
 {
     SAL_WARN_IF( !xStorage.is(), "embeddedobj.common", "No storage is provided for storing!" );
 
@@ -742,6 +763,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed:
             xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
     }
 
+    OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs);
+
     if ( xDoc.is() )
     {
         OUString aFilterName = GetFilterName( nStorageFormat );
@@ -750,13 +773,17 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed:
         if ( aFilterName.isEmpty() )
             throw io::IOException(); // TODO:
 
-        uno::Sequence< beans::PropertyValue > aArgs( 3 );
+        uno::Sequence<beans::PropertyValue> aArgs(5);
         aArgs[0].Name = "FilterName";
         aArgs[0].Value <<= aFilterName;
-        aArgs[2].Name = "DocumentBaseURL";
-        aArgs[2].Value <<= aBaseURL;
         aArgs[1].Name = "HierarchicalDocumentName";
         aArgs[1].Value <<= aHierarchName;
+        aArgs[2].Name = "DocumentBaseURL";
+        aArgs[2].Value <<= aBaseURL;
+        aArgs[3].Name = "SourceShellID";
+        aArgs[3].Value <<= getStringPropertyValue(rObjArgs, "SourceShellID");
+        aArgs[4].Name = "DestinationShellID";
+        aArgs[4].Value <<= getStringPropertyValue(rObjArgs, "DestinationShellID");
 
         xDoc->storeToStorage( xStorage, aArgs );
         if ( bAttachToTheStorage )
@@ -1237,7 +1264,8 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed::
 
         aGuard.clear();
         // TODO/LATER: support hierarchical name for embedded objects in embedded objects
-        StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false );
+        StoreDocToStorage_Impl(
+            xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false );
         aGuard.reset();
 
         if ( bSwitchBackToLoaded )
@@ -1374,7 +1402,8 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed::
     {
         aGuard.clear();
         // TODO/LATER: support hierarchical name for embedded objects in embedded objects
-        StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false );
+        StoreDocToStorage_Impl(
+            xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false );
         aGuard.reset();
 
         if ( bSwitchBackToLoaded )
@@ -1599,7 +1628,8 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
         }
 
         aGuard.clear();
-        StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, true );
+        uno::Sequence<beans::PropertyValue> aEmpty;
+        StoreDocToStorage_Impl( m_xObjectStorage, aEmpty, aEmpty, nStorageFormat, m_aEntryName, true );
         aGuard.reset();
     }
 
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index 98354f3..ceba61e 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -195,11 +195,13 @@ private:
 
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > InitNewDocument_Impl();
 
-    void StoreDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
-                                sal_Int32 nStorageVersion,
-                                const OUString& aBaseURL,
-                                const OUString& aHierarchName,
-                                bool bAttachToStorage );
+    void StoreDocToStorage_Impl(
+        const css::uno::Reference<css::embed::XStorage>& xStorage,
+        const css::uno::Sequence<css::beans::PropertyValue>& rMediaArgs,
+        const css::uno::Sequence<css::beans::PropertyValue>& rObjArgs,
+        sal_Int32 nStorageVersion,
+        const OUString& aHierarchName,
+        bool bAttachToStorage );
 
     void SwitchDocToStorage_Impl(
             const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc,
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
index 28be667..8895a8d 100644
--- a/include/comphelper/embeddedobjectcontainer.hxx
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -58,7 +58,9 @@ class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
 
 public:
     // add an embedded object to the container storage
-    bool            StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString&, bool );
+    bool StoreEmbeddedObject(
+        const css::uno::Reference<css::embed::XEmbeddedObject>& xObj, OUString& rName, bool bCopy,
+        const OUString& rSrcShellID, const OUString& rDestShellID );
 
     // add an embedded object that has been imported from the container storage - should only be called by filters!
     void                AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const OUString& );
@@ -119,7 +121,9 @@ public:
                         InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, OUString& );
 
     // copy an embedded object into the storage, open the new copy and return it
-    ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, /* TODO const OUString& aOrigName,*/ OUString& rName );
+    css::uno::Reference <css::embed::XEmbeddedObject> CopyAndGetEmbeddedObject(
+        EmbeddedObjectContainer& rSrc, const css::uno::Reference <css::embed::XEmbeddedObject>& xObj, OUString& rName,
+        const OUString& rSrcShellID, const OUString& rDestShellID );
 
     // move an embedded object from one container to another one
     bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 79082aa..df5738a 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -219,6 +219,8 @@ public:
 
     using SotObject::GetInterface;
 
+    static OUString CreateShellID( const SfxObjectShell* pShell );
+
     // Document-Shell Iterator
     static SfxObjectShell*      GetFirst( const TypeId* pType = 0,
                                           bool bOnlyVisible = true );
diff --git a/include/svtools/embedtransfer.hxx b/include/svtools/embedtransfer.hxx
index 61622e9..3fd24ce 100644
--- a/include/svtools/embedtransfer.hxx
+++ b/include/svtools/embedtransfer.hxx
@@ -33,10 +33,12 @@ private:
     Graphic* m_pGraphic;
     sal_Int64 m_nAspect;
 
+    OUString maParentShellID;
+
 protected:
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool        GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual void        ObjectReleased() SAL_OVERRIDE;
 
 public:
@@ -46,6 +48,8 @@ public:
                             sal_Int64 nAspect );
     virtual ~SvEmbedTransferHelper();
 
+    void SetParentShellID( const OUString& rShellID );
+
     static void         FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc,
                             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
                             const Graphic* pGraphic,
diff --git a/include/svtools/stringtransfer.hxx b/include/svtools/stringtransfer.hxx
index 67197be..9f3869a 100644
--- a/include/svtools/stringtransfer.hxx
+++ b/include/svtools/stringtransfer.hxx
@@ -41,8 +41,8 @@ namespace svt
 
     protected:
         // TransferableHelper overridables
-        virtual void                AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor ) SAL_OVERRIDE;
+        virtual void AddSupportedFormats() SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& _rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     };
 
 
diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 8e4965b..03932c5 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -29,7 +29,7 @@
 #include <cppuhelper/implbase4.hxx>
 #include <com/sun/star/frame/XTerminateListener.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/datatransfer/XTransferable2.hpp>
 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
@@ -126,7 +126,7 @@ struct ExecuteDropEvent
         mbDefault( false ) {}
 };
 
-class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable,
+class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable2,
                                                            ::com::sun::star::datatransfer::clipboard::XClipboardOwner,
                                                            ::com::sun::star::datatransfer::dnd::XDragSourceListener,
                                                            ::com::sun::star::lang::XUnoTunnel >
@@ -177,6 +177,11 @@ private:
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    // Transferable2
+    virtual css::uno::Any SAL_CALL getTransferData2(
+        const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
+            throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
     // XEventListener
     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
@@ -235,7 +240,7 @@ protected:
 protected:
 
     virtual void        AddSupportedFormats() = 0;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0;
+    virtual bool        GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0;
     virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     virtual void        DragFinished( sal_Int8 nDropAction );
     virtual void        ObjectReleased();
@@ -311,8 +316,8 @@ public:
 
 public:
 
-    ::com::sun::star::uno::Any  GetAny( SotFormatStringId nFormat ) const;
-    ::com::sun::star::uno::Any  GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
+    css::uno::Any GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const;
+    css::uno::Any GetAny( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
 
     bool                        GetString( SotFormatStringId nFormat, OUString& rStr );
     bool                        GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
@@ -349,14 +354,14 @@ public:
     bool                        GetFileList( SotFormatStringId nFormat, FileList& rFileList );
     bool                        GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
 
-    bool                        GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
-    bool                        GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
+    css::uno::Sequence<sal_Int8> GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc );
+    css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
 
     bool                        GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
     bool                        GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
 
-    bool                        GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
-    bool                        GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
+    css::uno::Reference<css::io::XInputStream> GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc );
+    css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
 
     bool                        GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
 
@@ -492,7 +497,7 @@ class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
 protected:
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual void        DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
 
 public:
diff --git a/include/svx/dbaexchange.hxx b/include/svx/dbaexchange.hxx
index b04335d..801f3ec 100644
--- a/include/svx/dbaexchange.hxx
+++ b/include/svx/dbaexchange.hxx
@@ -147,7 +147,7 @@ namespace svx
     protected:
         // TransferableHelper overridables
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
 
         static sal_uInt32   getDescriptorFormatId();
 
@@ -225,7 +225,7 @@ namespace svx
 
     protected:
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void        ObjectReleased() SAL_OVERRIDE;
 
     protected:
@@ -275,7 +275,7 @@ namespace svx
 
     protected:
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void        ObjectReleased() SAL_OVERRIDE;
         static sal_uInt32   getDescriptorFormatId();
     };
diff --git a/include/svx/dbaobjectex.hxx b/include/svx/dbaobjectex.hxx
index a5b9c11..a767620 100644
--- a/include/svx/dbaobjectex.hxx
+++ b/include/svx/dbaobjectex.hxx
@@ -63,7 +63,7 @@ namespace svx
     protected:
         // TransferableHelper overridables
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
 
         static sal_uInt32   getDescriptorFormatId(bool _bExtractForm);
     };
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
index 4a714dc..21e27fa 100644
--- a/include/svx/fmview.hxx
+++ b/include/svx/fmview.hxx
@@ -108,8 +108,6 @@ public:
 
     // for copying complete form structures, not only control models
     virtual SdrModel* GetMarkedObjModel() const SAL_OVERRIDE;
-    using E3dView::Paste;
-    virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
 
     virtual bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin ) SAL_OVERRIDE;
 
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index 8c19c4a..def4f9b 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -176,7 +176,7 @@ protected:
 
     // TransferableHelper
     virtual void                    AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool                    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual bool                    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     virtual void                    DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
     virtual void                    ObjectReleased() SAL_OVERRIDE;
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index ccdf58a..d93decd 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -580,6 +580,9 @@ public:
     // it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }".
     // Note that this function uses operator= internally.
     virtual SdrObject* Clone() const;
+
+    virtual SdrObject* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const;
+
     // implemented mainly for the purposes of Clone()
     SdrObject& operator=(const SdrObject& rObj);
 
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index ce42640..68ad43e 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -145,7 +145,10 @@ public:
     virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
     virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
 
-    SdrOle2Obj* Clone() const SAL_OVERRIDE;
+    virtual SdrOle2Obj* Clone() const SAL_OVERRIDE;
+    virtual SdrOle2Obj* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const SAL_OVERRIDE;
+
+    SdrOle2Obj& assignFrom( const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID );
     SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
 
     virtual void NbcMove(const Size& rSize) SAL_OVERRIDE;
diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx
index fa18cb5..f92a2f0 100644
--- a/include/svx/svdxcgv.hxx
+++ b/include/svx/svdxcgv.hxx
@@ -103,7 +103,10 @@ public:
     // View angezeigt wird.
     // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und
     // SDRINSERT_ADDMARK (siehe svdedtv.hxx).
-    virtual bool    Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+    virtual bool Paste(
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+        const OUString& rSrcShellID, const OUString& rDestShellID );
+
     bool            Paste(const OUString& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
     bool            Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
 
diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx
index 4681121..faf43db 100644
--- a/include/svx/view3d.hxx
+++ b/include/svx/view3d.hxx
@@ -98,7 +98,9 @@ public:
 
     // On Paste: We need to insert the objects of the Scene, but not the Scene itself
     using SdrView::Paste;
-    virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
+    virtual bool Paste(
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+        const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE;
 
     // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
     bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset);
diff --git a/include/svx/xmlexchg.hxx b/include/svx/xmlexchg.hxx
index 2c7f30d..7de6e3a 100644
--- a/include/svx/xmlexchg.hxx
+++ b/include/svx/xmlexchg.hxx
@@ -69,7 +69,7 @@ namespace svx
 
             // TransferableHelper overridables
             virtual void        AddSupportedFormats() SAL_OVERRIDE;
-            virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+            virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
 
             OXFormsDescriptor m_aDescriptor;
 
diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx
index d46663f..af866be 100644
--- a/include/xmloff/SchXMLExportHelper.hxx
+++ b/include/xmloff/SchXMLExportHelper.hxx
@@ -52,6 +52,9 @@ public:
     /// returns the string corresponding to the current FileFormat CLSID for Chart
     const OUString& getChartCLSID();
 
+    void SetSourceShellID( const OUString& rShellID );
+    void SetDestinationShellID( const OUString& rShellID );
+
 private:
     SchXMLExportHelper(); // not defined
     SchXMLExportHelper(SchXMLExportHelper &); // not defined
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index b45ed39..989eba3 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -210,6 +210,9 @@ protected:
     // This method must be overloaded to export the content of <office:body>.
     virtual void _ExportContent() = 0;
 
+    OUString GetSourceShellID() const;
+    OUString GetDestinationShellID() const;
+
     void SetExtended( bool bSet=true ) { mbExtended = bSet; }
 
     // save linked sections? (may be false in global documents)
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3ce5e06..8a07f15 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2112,6 +2112,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/datatransfer,\
 	XSystemTransferable \
 	XTransferDataAccess \
 	XTransferable \
+	XTransferable2 \
 	XTransferableEx \
 	XTransferableSource \
 	XTransferableSupplier \
diff --git a/offapi/com/sun/star/datatransfer/XTransferable2.idl b/offapi/com/sun/star/datatransfer/XTransferable2.idl
new file mode 100644
index 0000000..5ff7d58
--- /dev/null
+++ b/offapi/com/sun/star/datatransfer/XTransferable2.idl
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_datatransfer_XTransferable2_idl__
+#define __com_sun_star_datatransfer_XTransferable2_idl__
+
+#include <com/sun/star/datatransfer/XTransferable2.idl>
+
+module com { module sun { module star { module datatransfer {
+
+interface XTransferable2 : com::sun::star::datatransfer::XTransferable
+{
+    /** This is equivalent of getTransferData of XTransferable, but takes an
+        additional parameter that specifies the destination document type.
+
+        @param aFlavor requested data format
+        @param aDestShellID destination document shell ID.  The ID of each
+        individual shell must be unique.
+
+        @returns data in specified data format.
+
+        @throws com::sun::star::io::IOException
+        if the data is no longer available in the requested flavor.
+
+        @throws com::sun::star::datatransfer::UnsupportedFlavorException
+        if the requested DataFlavor is not supported.
+     */
+    any getTransferData2( [in] DataFlavor aFlavor, [in] string aDestShellID )
+        raises ( UnsupportedFlavorException, com::sun::star::io::IOException );
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/reportdesign/source/ui/dlg/GroupExchange.cxx b/reportdesign/source/ui/dlg/GroupExchange.cxx
index 979dd5c..75ab80e 100644
--- a/reportdesign/source/ui/dlg/GroupExchange.cxx
+++ b/reportdesign/source/ui/dlg/GroupExchange.cxx
@@ -49,7 +49,7 @@ namespace rptui
         }
     }
 
-    bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+    bool OGroupExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
     {
         sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
         if(nFormat == OGroupExchange::getReportGroupId() )
diff --git a/reportdesign/source/ui/dlg/GroupExchange.hxx b/reportdesign/source/ui/dlg/GroupExchange.hxx
index 57259b5..39c206b 100644
--- a/reportdesign/source/ui/dlg/GroupExchange.hxx
+++ b/reportdesign/source/ui/dlg/GroupExchange.hxx
@@ -37,7 +37,7 @@ namespace rptui
         static sal_uInt32   getReportGroupId();
     protected:
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void        ObjectReleased() SAL_OVERRIDE;
     };
 }
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 441658b..edfd426 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -272,7 +272,7 @@ sal_Int8 OFieldExpressionControl::ExecuteDrop( const BrowserExecuteDropEvent& rE
         SetNoSelection();
 
         TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
-        uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId());
+        uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId(), OUString());
         uno::Sequence< uno::Any > aGroups;
         aDrop >>= aGroups;
         if ( aGroups.getLength() )
@@ -865,7 +865,7 @@ void OFieldExpressionControl::InsertRows( long nRow )
         SotExchange::GetFormatDataFlavor(OGroupExchange::getReportGroupId(), aFlavor);
         uno::Sequence< uno::Any > aGroups;
 
-        if( (aTransferData.GetAny(aFlavor) >>= aGroups) && aGroups.getLength() )
+        if ((aTransferData.GetAny(aFlavor, OUString()) >>= aGroups) && aGroups.getLength())
         {
             m_bIgnoreEvent = false;
             {
diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx
index 4ac25e4..39609c0 100644
--- a/reportdesign/source/ui/inc/dlgedclip.hxx
+++ b/reportdesign/source/ui/inc/dlgedclip.hxx
@@ -70,7 +70,7 @@ public:
 protected:
     // TransferableHelper overridables
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
 private:
     TSectionElements    m_aCopyElements;
 };
diff --git a/reportdesign/source/ui/report/dlgedclip.cxx b/reportdesign/source/ui/report/dlgedclip.cxx
index a605094..5d95b0d 100644
--- a/reportdesign/source/ui/report/dlgedclip.cxx
+++ b/reportdesign/source/ui/report/dlgedclip.cxx
@@ -52,7 +52,7 @@ void OReportExchange::AddSupportedFormats()
     AddFormat(getDescriptorFormatId());
 }
 
-bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor )
+bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
 {
     const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
     return (nFormatId == getDescriptorFormatId()) && SetAny( uno::Any(m_aCopyElements), _rFlavor );
@@ -76,7 +76,7 @@ OReportExchange::TSectionElements OReportExchange::extractCopies(const Transfera
         SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
         OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid data format (no flavor)!");
 
-        uno::Any aDescriptor = _rData.GetAny(aFlavor);
+        uno::Any aDescriptor = _rData.GetAny(aFlavor, OUString());
 
         TSectionElements aCopies;
 #if OSL_DEBUG_LEVEL > 0
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 547fd14..9bb6bd6 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -27,6 +27,7 @@
 #include "types.hxx"
 #include "mtvelements.hxx"
 #include <formula/types.hxx>
+#include <svl/zforlist.hxx>
 
 #include <set>
 #include <vector>
@@ -232,7 +233,10 @@ public:
 
     void CopyToClip(
         sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
-    void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
+
+    void CopyStaticToDocument(
+        SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
+
     void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
     bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
     bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e1aabf4..3db9fb9 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -40,6 +40,7 @@
 #include "calcconfig.hxx"
 #include <tools/fract.hxx>
 #include <tools/gen.hxx>
+#include <svl/zforlist.hxx>
 
 #include <memory>
 #include <map>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0c00851..6492f81 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -412,7 +412,11 @@ public:
     void        DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
     void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
     void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
-    void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
+
+    void CopyStaticToDocument(
+        SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
+        ScTable* pDestTab );
+
     void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
 
     bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index f0dc03a..3e4c4ae 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1048,7 +1048,8 @@ void ScColumn::CopyToClip(
     rColumn.CellStorageModified();
 }
 
-void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol)
+void ScColumn::CopyStaticToDocument(
+    SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol )
 {
     if (nRow1 > nRow2)
         return;
@@ -1157,6 +1158,17 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
             break;
     }
 
+    // Dont' forget to copy the number formats over.  Charts may reference them.
+    for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+    {
+        sal_uInt32 nNumFmt = GetNumberFormat(nRow);
+        SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt);
+        if (itNum != rMap.end())
+            nNumFmt = itNum->second;
+
+        rDestCol.SetNumberFormat(nRow, nNumFmt);
+    }
+
     rDestCol.CellStorageModified();
 }
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 95894d2..8f01973 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2157,8 +2157,12 @@ void ScDocument::CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab,
     if (!pSrcTab || !pDestTab)
         return;
 
+    pDestDoc->GetFormatTable()->MergeFormatter(*GetFormatTable());
+    SvNumberFormatterMergeMap aMap = pDestDoc->GetFormatTable()->ConvertMergeTableToMap();
+
     pSrcTab->CopyStaticToDocument(
-        rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(), pDestTab);
+        rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(),
+        aMap, pDestTab);
 }
 
 void ScDocument::CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 900c29b..bba3095 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -556,7 +556,8 @@ void ScTable::CopyToClip(
     }
 }
 
-void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab)
+void ScTable::CopyStaticToDocument(
+    SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScTable* pDestTab )
 {
     if (nCol1 > nCol2)
         return;
@@ -565,7 +566,7 @@ void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW
     {
         ScColumn& rSrcCol = aCol[i];
         ScColumn& rDestCol = pDestTab->aCol[i];
-        rSrcCol.CopyStaticToDocument(nRow1, nRow2, rDestCol);
+        rSrcCol.CopyStaticToDocument(nRow1, nRow2, rMap, rDestCol);
     }
 }
 
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 40d4808..5288b1d 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -91,7 +91,8 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
     pDragSourceView( NULL ),
     nDragSourceFlags( 0 ),
     bDragWasInternal( false ),
-    nSourceDocID( 0 )
+    nSourceDocID( 0 ),
+    maShellID(SfxObjectShell::CreateShellID(pContainerShell))
 {
 
     //  check what kind of objects are contained
@@ -335,12 +336,8 @@ void ScDrawTransferObj::AddSupportedFormats()
         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
         AddFormat( SOT_FORMAT_GDIMETAFILE );
 
-        if ( !aOleData.GetTransferable().is() )
-        {
-            SdrOle2Obj* pObj = GetSingleObject();
-            if ( pObj && pObj->GetObjRef().is() )
-                aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ;
-        }
+        CreateOLEData();
+
         if ( aOleData.GetTransferable().is() )
         {
             //  get format list from object snapshot
@@ -372,19 +369,14 @@ void ScDrawTransferObj::AddSupportedFormats()
 //      AddFormat( SOT_FORMATSTR_ID_SVIM );
 }
 
-bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
 {
     bool bOK = false;
     sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
 
     if ( bOleObj && nFormat != SOT_FORMAT_GDIMETAFILE )
     {
-        if ( !aOleData.GetTransferable().is() )
-        {
-            SdrOle2Obj* pObj = GetSingleObject();
-            if ( pObj && pObj->GetObjRef().is() )
-                aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ;
-        }
+        CreateOLEData();
 
         if( aOleData.GetTransferable().is() && aOleData.HasFormat( rFlavor ) )
         {
@@ -396,7 +388,7 @@ bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavo
                 pModel->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE );
             }
 
-            bOK = SetAny( aOleData.GetAny( rFlavor ), rFlavor );
+            bOK = SetAny( aOleData.GetAny(rFlavor, rDestDoc), rFlavor );
 
             if( pModel )
                 pModel->SetSwapGraphicsMode( nOldSwapMode );
@@ -697,6 +689,11 @@ void ScDrawTransferObj::SetDragWasInternal()
     bDragWasInternal = true;
 }
 
+OUString ScDrawTransferObj::GetShellID() const
+{
+    return maShellID;
+}
+
 SdrOle2Obj* ScDrawTransferObj::GetSingleObject()
 {
     //  if single OLE object was copied, get its object
@@ -715,6 +712,26 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject()
     return NULL;
 }
 
+void ScDrawTransferObj::CreateOLEData()
+{
+    if (aOleData.GetTransferable().is())
+        // Already created.
+        return;
+
+    SdrOle2Obj* pObj = GetSingleObject();
+    if (!pObj || !pObj->GetObjRef().is())
+        // No OLE object present.
+        return;
+
+    SvEmbedTransferHelper* pEmbedTransfer =
+        new SvEmbedTransferHelper(
+            pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect());
+
+    pEmbedTransfer->SetParentShellID(maShellID);
+
+    aOleData = TransferableDataHelper(pEmbedTransfer);
+}
+
 
 //  initialize aDocShellRef with a live document from the ClipDoc
 
@@ -736,7 +753,10 @@ void ScDrawTransferObj::InitDocShell()
         // SdrExchangeView aDestView( pDestModel );
         SdrView aDestView( pDestModel );
         aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
-        aDestView.Paste( *pModel, Point( aSrcSize.Width()/2, aSrcSize.Height()/2 ) );
+        aDestView.Paste(
+            *pModel,
+            Point(aSrcSize.Width()/2, aSrcSize.Height()/2),
+            NULL, 0, OUString(), OUString());
 
         // put objects to right layer (see ScViewFunc::PasteDataFormat for SOT_FORMATSTR_ID_DRAWING)
 
diff --git a/sc/source/ui/app/lnktrans.cxx b/sc/source/ui/app/lnktrans.cxx
index 734d9b7..69a5cbe 100644
--- a/sc/source/ui/app/lnktrans.cxx
+++ b/sc/source/ui/app/lnktrans.cxx
@@ -53,7 +53,8 @@ void ScLinkTransferObj::AddSupportedFormats()
     }
 }
 
-bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+bool ScLinkTransferObj::GetData(
+    const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
 {
     bool bOK = false;
     if ( !aLinkURL.isEmpty() )
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 0140ab5..2008695 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -389,7 +389,8 @@ ScDrawTransferObj* ScSelectionTransferObj::GetDrawData()
     return pDrawData;
 }
 
-bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+bool ScSelectionTransferObj::GetData(
+    const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
 {
     bool bOK = false;
 
@@ -416,7 +417,7 @@ bool ScSelectionTransferObj::GetData( const ::com::sun::star::datatransfer::Data
     if ( xSource.is() )
     {
         TransferableDataHelper aHelper( xSource );
-        uno::Any aAny = aHelper.GetAny( rFlavor );
+        uno::Any aAny = aHelper.GetAny(rFlavor, rDestDoc);
         bOK = SetAny( aAny, rFlavor );
     }
 
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index a538cd3..1d3bb94 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -241,7 +241,7 @@ void ScTransferObj::AddSupportedFormats()
         AddFormat( SOT_FORMATSTR_ID_EDITENGINE );
 }
 
-bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
+bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
 {
     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
     bool        bOK = false;
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 5b71558..efca067 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -63,17 +63,20 @@ private:
 
     ScRangeListVector               m_aProtectedChartRangesVector;
 
+    OUString maShellID;
 
     void                InitDocShell();
     SdrOle2Obj* GetSingleObject();
 
+    void CreateOLEData();
+
 public:
             ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContainerShell,
                                 const TransferableObjectDescriptor& rDesc );
     virtual ~ScDrawTransferObj();
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     virtual void        ObjectReleased() SAL_OVERRIDE;
@@ -87,6 +90,8 @@ public:
     void                SetDragSourceFlags( sal_uInt16 nFlags );
     void                SetDragWasInternal();
 
+    OUString GetShellID() const;
+
     SdrView*            GetDragSourceView()             { return pDragSourceView; }
     sal_uInt16              GetDragSourceFlags() const      { return nDragSourceFlags; }
 
diff --git a/sc/source/ui/inc/lnktrans.hxx b/sc/source/ui/inc/lnktrans.hxx
index 2e47e41..033da1b 100644
--- a/sc/source/ui/inc/lnktrans.hxx
+++ b/sc/source/ui/inc/lnktrans.hxx
@@ -36,7 +36,7 @@ public:
     void                SetLinkURL( const OUString& rURL, const OUString& rText );
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual void        ObjectReleased() SAL_OVERRIDE;
     virtual void        DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
 };
diff --git a/sc/source/ui/inc/seltrans.hxx b/sc/source/ui/inc/seltrans.hxx
index e7eb1ed..3abfd11 100644
--- a/sc/source/ui/inc/seltrans.hxx
+++ b/sc/source/ui/inc/seltrans.hxx
@@ -65,7 +65,7 @@ public:
     ScDrawTransferObj*  GetDrawData();
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual void        ObjectReleased() SAL_OVERRIDE;
 };
 
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index debff33..6ee2855 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -72,7 +72,7 @@ public:
     virtual ~ScTransferObj();
 
     virtual void        AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     virtual void        ObjectReleased() SAL_OVERRIDE;
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index e686a01..6cf3825 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -119,8 +119,8 @@ public:
                                                        ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
 
     void            PasteDraw();
-    void            PasteDraw( const Point& rLogicPos, SdrModel* pModel,
-                                bool bGroup = false, bool bSameDocClipboard = false );
+    void PasteDraw( const Point& rLogicPos, SdrModel* pModel, bool bGroup,
+                    const OUString& rSrcShellID, const OUString& rDestShellID );
 
     bool            PasteOnDrawObjectLinked(
                         const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4c408bd..38e0b86 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4433,7 +4433,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
 
         bPasteIsMove = bIsMove;
 
-        pViewData->GetView()->PasteDraw( aLogicPos, rData.pDrawTransfer->GetModel() );
+        pViewData->GetView()->PasteDraw(
+            aLogicPos, rData.pDrawTransfer->GetModel(), false, "A", "B");
 
         if (bPasteIsMove)
             rData.pDrawTransfer->SetDragWasInternal();
@@ -4536,8 +4537,9 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
 
                 //  bSameDocClipboard argument for PasteDraw is needed
                 //  because only DragData is checked directly inside PasteDraw
-                pViewData->GetView()->PasteDraw( aLogicPos, pDrawTransfer->GetModel(), false,
-                            pDrawTransfer->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+                pViewData->GetView()->PasteDraw(
+                    aLogicPos, pDrawTransfer->GetModel(), false,
+                    pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
             }
         }
     }
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index d82e725..be5d96c 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -447,8 +447,11 @@ void ScViewFunc::PasteDraw()
                                      pViewData->GetActivePart() ) );
     ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin );
     if (pDrawClip)
-        PasteDraw( aPos, pDrawClip->GetModel(), false,
-            pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+    {
+        OUString aSrcShellID = pDrawClip->GetShellID();
+        OUString aDestShellID = SfxObjectShell::CreateShellID(pViewData->GetDocShell());
+        PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID);
+    }
 }
 
 void ScViewFunc::PasteFromSystem()
@@ -584,7 +587,9 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran
         SCROW nPosY = pViewData->GetCurY();
         Window* pWin = GetActiveWin();
         Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, pViewData->GetActivePart() ) );
-        PasteDraw( aPos, pDrawClip->GetModel(), false, pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+        PasteDraw(
+            aPos, pDrawClip->GetModel(), false,
+            pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
     }
     else
     {
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index dc708e0..9d39811 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -117,8 +117,10 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
         uno::Reference < io::XInputStream > xStm;
         TransferableObjectDescriptor   aObjDesc;
 
-        if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
-            aDataHelper.GetInputStream( nFormatId, xStm ) )
+        if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
+            xStm = aDataHelper.GetInputStream(nFormatId, OUString());
+
+        if (xStm.is())
         {
             if ( aObjDesc.maClassName == SvGlobalName( SO3_SC_CLASSID_60 ) )
             {
@@ -209,9 +211,11 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
             {
                 OUString aName;
                 uno::Reference < embed::XEmbeddedObject > xObj;
+                xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
+                if (!xStm.is())
+                    aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
 
-                if ( aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm )
-                  || aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
+                if (xStm.is())
                 {
                     xObj = GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
                 }
@@ -518,7 +522,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
                 nObjCount += pPage->GetObjCount();          // count group object only once
             }
 
-            PasteDraw( aPos, pModel.get(), (nObjCount > 1) );     // grouped if more than 1 object
+            PasteDraw(aPos, pModel.get(), (nObjCount > 1), "A", "B");     // grouped if more than 1 object
             pModel.reset();
             aDragShellRef->DoClose();
             bRet = true;
@@ -528,8 +532,8 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
     {
         //  do excel import into a clipboard document
         //TODO/MBA: testing
-        uno::Reference < io::XInputStream > xStm;
-        if( aDataHelper.GetInputStream( nFormatId, xStm ) )
+        uno::Reference <io::XInputStream> xStm = aDataHelper.GetInputStream(nFormatId, OUString());
+        if (xStm.is())
         {
             ScDocument* pInsDoc = new ScDocument( SCDOCMODE_CLIP );
             SCTAB nSrcTab = 0;      // Biff5 in clipboard: always sheet 0
@@ -629,8 +633,8 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
     //  get link data from transferable before string data,
     //  so the source knows it will be used for a link
 
-    uno::Sequence<sal_Int8> aSequence;
-    if ( !aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aSequence ) )
+    uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString());
+    if (!aSequence.getLength())
     {
         OSL_FAIL("DDE Data not found.");
         return false;
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 4cf39cf..8799d59 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -74,8 +74,10 @@ static void lcl_AdjustInsertPos( ScViewData* pData, Point& rPos, Size& rSize )
 }
 
 void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
-        bool bGroup, bool bSameDocClipboard )
+        bool bGroup, const OUString& rSrcShellID, const OUString& rDestShellID )
 {
+    bool bSameDocClipboard = rSrcShellID == rDestShellID;
+
     MakeDrawLayer();
     Point aPos( rLogicPos );
 
@@ -221,7 +223,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
         if ( !bSameDocClipboard )
             GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( true );
 
-        pScDrawView->Paste( *pModel, aPos, NULL, nOptions );
+        pScDrawView->Paste(*pModel, aPos, NULL, nOptions, rSrcShellID, rDestShellID);
 
         if ( !bSameDocClipboard )
             GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false );
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 5621826..936a5d5 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1095,7 +1095,7 @@ bool SdDrawDocument::InsertBookmarkAsObject(
             pBMView->GetDoc().SetAllocDocSh(true);
 
         SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetMarkedObjModel();
-        bOK = pView->Paste(*pTmpDoc, aObjPos, pPage);
+        bOK = pView->Paste(*pTmpDoc, aObjPos, pPage, 0, OUString(), OUString());
 
         if (bOLEObjFound)
             pBMView->GetDoc().SetAllocDocSh(false);
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 77997dc..c2ca420 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -448,7 +448,7 @@ void SdTransferable::AddSupportedFormats()
     }
 }
 
-bool SdTransferable::GetData( const DataFlavor& rFlavor )
+bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
 {
     if (SD_MOD()==NULL)
         return false;
@@ -476,7 +476,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor )
         if( nFormat == FORMAT_GDIMETAFILE && mpGraphic )
             bOK = SetGDIMetaFile( mpGraphic->GetGDIMetaFile(), rFlavor );
         else
-            bOK = SetAny( mpOLEDataHelper->GetAny( rFlavor ), rFlavor );
+            bOK = SetAny( mpOLEDataHelper->GetAny(rFlavor, rDestDoc), rFlavor );
 
         if( mpSdDrawDocumentIntern )
             mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 72f6e7d..87e7e8d 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -125,7 +125,7 @@ void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats()
 
 
 
-bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
 {
     sal_uLong nFormatId = SotExchange::GetFormat( rFlavor );
     switch (nFormatId)
diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx
index 2ec16b9..1700921 100644
--- a/sd/source/ui/inc/TabControl.hxx
+++ b/sd/source/ui/inc/TabControl.hxx
@@ -95,7 +95,7 @@ private:
         virtual             ~TabControlTransferable();
 
         virtual void        AddSupportedFormats() SAL_OVERRIDE;
-        virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         virtual void        DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
 
     };
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index da4098d..cd80568 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -177,7 +177,10 @@ public:
     virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE;
 
     virtual SdrModel*   GetMarkedObjModel() const SAL_OVERRIDE;
-    virtual bool        Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
+    virtual bool Paste(
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+        const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE;
+
     using SdrExchangeView::Paste;
 
     /** returns true if we have an undo manager and there is an open list undo action */
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index dad48ca..fdeff1b 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -100,7 +100,7 @@ public:
         SAL_DLLPRIVATE virtual               ~SdPageObjsTransferable();
 
         SAL_DLLPRIVATE virtual void      AddSupportedFormats() SAL_OVERRIDE;
-        SAL_DLLPRIVATE virtual bool      GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+        SAL_DLLPRIVATE virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
         SAL_DLLPRIVATE virtual void      DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
 
         SAL_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx
index 10ebdf7..4f9f419 100644
--- a/sd/source/ui/inc/sdxfer.hxx
+++ b/sd/source/ui/inc/sdxfer.hxx
@@ -106,7 +106,7 @@ public:
 protected:
 
     virtual void                    AddSupportedFormats() SAL_OVERRIDE;
-    virtual bool                    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
+    virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     virtual bool                    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     virtual void                    ObjectReleased() SAL_OVERRIDE;
 
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 32e9bde..c400af7 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -977,9 +977,11 @@ SdrModel* View::GetMarkedObjModel() const
     return FmFormView::GetMarkedObjModel();;
 }
 
-bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */)
+bool View::Paste(
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
-    return FmFormView::Paste( rMod, rPos, pLst,nOptions );;
+    return FmFormView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID);
 }
 
 } // end of namespace sd
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 89e7aeb..f841807 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -603,7 +603,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel();
                     pSourceDoc->CreatingDataObj( pOwnData );
                     SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetMarkedObjModel();
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
                     if( !pPage )
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -644,7 +644,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     pWorkModel->DeletePage( (sal_uInt16) i );
             }
 
-            bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions );
+            bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
             if( !pPage )
                 pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -803,7 +803,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
                     }
 
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
                 }
 
                 xShell->DoClose();
@@ -844,9 +844,15 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
         uno::Reference < io::XInputStream > xStm;
         TransferableObjectDescriptor    aObjDesc;
 
-        if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
-            ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) ||
-              aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) )
+        if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
+        {
+            OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh());
+            xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, aDocShellID);
+            if (!xStm.is())
+                xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ, aDocShellID);
+        }
+
+        if (xStm.is())
         {
             if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
             {
@@ -880,7 +886,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                             pModel->DeletePage( (sal_uInt16) i );
                     }
 
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
                     if( !pPage )
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -1029,8 +1035,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                 uno::Reference < embed::XEmbeddedObject > xObj;
                 OUString aName;
 
-                if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) ||
-                    aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
+                xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
+                if (!xStm.is())
+                    xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
+
+                if (xStm.is())
                 {
                     xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
                 }
@@ -1504,7 +1513,7 @@ bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nP
     pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
 
     CreateTableFromRTF( *xStm, pModel );
-    bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+    bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
     xComponent->dispose();
     xComponent.clear();
diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx
index 827739a..2df6a85b 100644
--- a/sd/source/ui/view/tabcontr.cxx
+++ b/sd/source/ui/view/tabcontr.cxx
@@ -62,7 +62,7 @@ void TabControl::TabControlTransferable::AddSupportedFormats()
 
 
 
-bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& )
+bool TabControl::TabControlTransferable::GetData( const css::datatransfer::DataFlavor& /*rFlavor*/, const OUString& /*rDestDoc*/ )
 {
     return false;
 }
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index b0b2347..60ae2ef 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -474,7 +474,24 @@ bool SfxObjectShell::Close()
     return true;
 }
 
+OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell )
+{
+    if (!pShell)
+        return OUString();
+
+    OUString aShellID;
+
+    SfxMedium* pMedium = pShell->GetMedium();
+    if (pMedium)
+        aShellID = pMedium->GetBaseURL();
 
+    if (!aShellID.isEmpty())
+        return aShellID;
+
+    sal_Int64 nShellID = reinterpret_cast<sal_Int64>(pShell);
+    aShellID = "0x" + OUString::number(nShellID, 16);
+    return aShellID;
+}
 
 // returns a pointer the first SfxDocument of specified type
 
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index f7617d4..1de12e6 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1570,8 +1570,10 @@ void SmViewShell::Execute(SfxRequest& rReq)
             if( aData.GetTransferable().is() &&
                 ( aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ||
                   (aData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) &&
-                   aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE ))) &&
-                aData.GetInputStream( nId, xStrm ) && xStrm.is() )
+                   aData.HasFormat( nId = SOT_FORMATSTR_ID_EMBED_SOURCE ))))
+                xStrm = aData.GetInputStream(nId, OUString());
+
+            if (xStrm.is())
             {
                 try
                 {
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 89c1ca2..6a43d98 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1243,9 +1243,8 @@ sal_Int8 SvTreeListBox::ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox
     TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
     if( aData.HasFormat( SOT_FORMATSTR_ID_TREELISTBOX ))
     {
-        ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
-        if( aData.GetSequence( SOT_FORMATSTR_ID_TREELISTBOX, aSeq ) &&
-            sizeof(SvLBoxDDInfo) == aSeq.getLength() )
+        css::uno::Sequence<sal_Int8> aSeq = aData.GetSequence(SOT_FORMATSTR_ID_TREELISTBOX, OUString());
+        if (sizeof(SvLBoxDDInfo) == aSeq.getLength())
         {
             memcpy( &aDDInfo, aSeq.getConstArray(), sizeof(SvLBoxDDInfo) );
             nRet = rEvt.mnAction;
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index 767ab0e..c7d9aa0 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -293,7 +293,7 @@ bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData, O
 
         uno::Any aAny;
         if( rData.HasFormat( aFlavor ) &&
-            ( aAny = rData.GetAny( aFlavor ) ).hasValue() )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list