[Libreoffice-commits] core.git: Branch 'private/kohei/chart-bugs' - comphelper/source include/comphelper include/svx sc/source sd/source svx/source sw/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Jun 19 07:50:46 PDT 2014


Rebased ref, commits from common ancestor:
commit 52036f1a18e92e4e7f6230895dbb12564b8d0850
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Jun 18 23:20:55 2014 -0400

    Pass source and destination shell IDs when pasting from Calc to Calc.
    
    This modifies the signature of one variant of Paste() virtual method of
    SdrExchangeView and its child classes.
    
    Change-Id: I54c39b18c260e25d78e126aaabeaaf642ad049f8

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/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/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/svdobj.hxx b/include/svx/svdobj.hxx
index 84ebec0..e23e794 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/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 14d4088..5288b1d 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -689,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
@@ -748,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/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 5b4e869..efca067 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -90,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/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 790f749..780c4b3 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 8236fd6..9d39811 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -522,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;
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 bc2af1c..65b6ff7 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/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 80dd74e..b78671d 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -195,7 +195,10 @@ public:
     virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE;
 
     virtual SdrModel*   GetMarkedObjModel() const SAL_OVERRIDE;
-    virtual bool        Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
+    virtual bool Paste(
+        const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+        const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE;
+
     using SdrExchangeView::Paste;
 
     /** returns true if we have an undo manager and there is an open list undo action */
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 631a238..9fdad1d 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -976,9 +976,11 @@ SdrModel* View::GetMarkedObjModel() const
     return FmFormView::GetMarkedObjModel();;
 }
 
-bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */)
+bool View::Paste(
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
-    return FmFormView::Paste( rMod, rPos, pLst,nOptions );;
+    return FmFormView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID);
 }
 
 } // end of namespace sd
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index f59139d..315433c 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -604,7 +604,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel();
                     pSourceDoc->CreatingDataObj( pOwnData );
                     SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetMarkedObjModel();
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
                     if( !pPage )
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -645,7 +645,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     pWorkModel->DeletePage( (sal_uInt16) i );
             }
 
-            bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions );
+            bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
             if( !pPage )
                 pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -804,7 +804,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
                     }
 
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
                 }
 
                 xShell->DoClose();
@@ -887,7 +887,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                             pModel->DeletePage( (sal_uInt16) i );
                     }
 
-                    bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+                    bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
                     if( !pPage )
                         pPage = (SdPage*) GetSdrPageView()->GetPage();
@@ -1513,7 +1513,7 @@ bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nP
     pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
 
     CreateTableFromRTF( *xStm, pModel.get() );
-    bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions );
+    bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
 
     xComponent->dispose();
     xComponent.clear();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 9659771..3ac2c0d 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -441,7 +441,9 @@ SdrModel* E3dView::GetMarkedObjModel() const
 // When pasting objects have to integrated if a scene is inserted, but
 // not the scene itself
 
-bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+bool E3dView::Paste(
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
     bool bRetval = false;
 
@@ -486,7 +488,7 @@ bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, s
     else
     {
         // call parent
-        bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions);
+        bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID);
     }
 
     return bRetval;
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index e6234e2..702fd00 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -379,13 +379,6 @@ SdrModel* FmFormView::GetMarkedObjModel() const
     return E3dView::GetMarkedObjModel();
 }
 
-
-bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
-{
-    return E3dView::Paste(rMod, rPos, pLst, nOptions);
-}
-
-
 void FmFormView::ActivateControls(SdrPageView* pPageView)
 {
     if (!pPageView)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index c18f84c..5d67de5 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1041,6 +1041,11 @@ SdrObject* SdrObject::Clone() const
     return CloneHelper< SdrObject >();
 }
 
+SdrObject* SdrObject::CloneWithShellIDs( const OUString& /*rSrcShellID*/, const OUString& /*rDestShellID*/ ) const
+{
+    return Clone();
+}
+
 SdrObject& SdrObject::operator=(const SdrObject& rObj)
 {
     if( this == &rObj )
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index e01dae9..86379ce 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1624,7 +1624,20 @@ SdrOle2Obj* SdrOle2Obj::Clone() const
     return CloneHelper< SdrOle2Obj >();
 }
 
-SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
+SdrOle2Obj* SdrOle2Obj::CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const
+{
+    SdrOle2Obj* pObj =
+        dynamic_cast<SdrOle2Obj*>(
+            SdrObjFactory::MakeNewObject(GetObjInventor(), GetObjIdentifier(), NULL));
+
+    if (pObj)
+        pObj->assignFrom(*this, rSrcShellID, rDestShellID);
+
+    return pObj;
+}
+
+SdrOle2Obj& SdrOle2Obj::assignFrom(
+    const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID )
 {
     //TODO/LATER: who takes over control of my old object?!
     if( &rObj != this )
@@ -1671,7 +1684,8 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
                 if ( xObj.is() )
                 {
                     OUString aTmp;
-                    xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() );
+                    xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
+                        rContainer, xObj, aTmp, rSrcShellID, rDestShellID), rOle2Obj.GetAspect());
                     m_bTypeAsked = false;
                     mpImpl->aPersistName = aTmp;
                     CheckFileLink_Impl();
@@ -1684,7 +1698,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
     return *this;
 }
 
-
+SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
+{
+    return assignFrom(rObj, OUString(), OUString());
+}
 
 void SdrOle2Obj::ImpSetVisAreaSize()
 {
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 0ec6046..5b3c57b 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -223,7 +223,9 @@ bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt
     return true;
 }
 
-bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+bool SdrExchangeView::Paste(
+    const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions,
+    const OUString& rSrcShellID, const OUString& rDestShellID )
 {
     const SdrModel* pSrcMod=&rMod;
     if (pSrcMod==pMod)
@@ -298,7 +300,7 @@ bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList*
         {
             const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
 
-            SdrObject* pNeuObj = pSrcOb->Clone();
+            SdrObject* pNeuObj = pSrcOb->CloneWithShellIDs(rSrcShellID, rDestShellID);
 
             if (pNeuObj!=NULL)
             {
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 9aaab2a..2dfa6a9 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1507,7 +1507,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
         // #i50824#
         // method <lcl_RemoveOleObjsFromSdrModel> replaced by <lcl_ConvertSdrOle2ObjsToSdrGrafObjs>
         lcl_ConvertSdrOle2ObjsToSdrGrafObjs( pModel );
-        pView->Paste( *pModel, aPos );
+        pView->Paste(*pModel, aPos, NULL, 0, OUString(), OUString());
 
         sal_uLong nCnt = pView->GetMarkedObjectList().GetMarkCount();
         if( nCnt )
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 188d012..7c47e26 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -435,7 +435,9 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     pPersistShell->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
         pSrc->GetEmbeddedObjectContainer(),
         pSrc->GetEmbeddedObjectContainer().GetEmbeddedObject( aOLEObj.aName ),
-        aNewName );
+        aNewName,
+        OUString(),
+        OUString());
 
     SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
                                     (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl(),
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index fbb75a9..10c1b7e 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -435,7 +435,7 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext)
             // TODO/LATER: Copying through the container would copy the replacement image as well
             comphelper::EmbeddedObjectContainer aCnt;
             OUString aName = aCnt.CreateUniqueObjectName();
-            if ( aCnt.StoreEmbeddedObject( rSwOLE.GetOleRef(), aName, true ) )
+            if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString()))
             {
                 uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
                 rDoc.Insert( rContext.GetRepeatPaM(),


More information about the Libreoffice-commits mailing list