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

Kohei Yoshida kohei.yoshida at collabora.com
Wed Jun 18 20:22:50 PDT 2014


 include/svx/fmview.hxx           |    2 --
 include/svx/svdxcgv.hxx          |    5 ++++-
 include/svx/view3d.hxx           |    4 +++-
 sc/source/ui/app/drwtrans.cxx    |   10 +++++++++-
 sc/source/ui/inc/drwtrans.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   |    2 +-
 sc/source/ui/view/viewfun7.cxx   |    6 ++++--
 sd/source/core/drawdoc3.cxx      |    2 +-
 sd/source/ui/inc/View.hxx        |    5 ++++-
 sd/source/ui/view/sdview2.cxx    |    6 ++++--
 sd/source/ui/view/sdview3.cxx    |   10 +++++-----
 svx/source/engine3d/view3d.cxx   |    6 ++++--
 svx/source/form/fmview.cxx       |    7 -------
 svx/source/svdraw/svdxcgv.cxx    |    4 +++-
 sw/source/core/frmedt/fecopy.cxx |    2 +-
 18 files changed, 60 insertions(+), 36 deletions(-)

New commits:
commit 3584219a1931b50c53c1d5d031a0c8b10d1f99e7
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/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/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/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 0ec6046..9356cb2 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)
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 )


More information about the Libreoffice-commits mailing list