[Libreoffice-commits] core.git: chart2/source include/svx sc/source sd/source svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 30 07:47:04 UTC 2018


 chart2/source/controller/main/ChartTransferable.cxx |    2 +-
 include/svx/svdxcgv.hxx                             |    2 +-
 include/svx/view3d.hxx                              |    2 +-
 sc/source/ui/app/seltrans.cxx                       |    2 +-
 sc/source/ui/navipi/content.cxx                     |    2 +-
 sc/source/ui/view/drawvie4.cxx                      |    8 ++++----
 sd/source/core/drawdoc3.cxx                         |    2 +-
 sd/source/ui/app/sdxfer.cxx                         |    4 ++--
 sd/source/ui/view/sdview2.cxx                       |    2 +-
 sd/source/ui/view/sdview3.cxx                       |    2 +-
 svx/source/engine3d/view3d.cxx                      |   16 ++++++++--------
 svx/source/svdraw/svdpage.cxx                       |    2 +-
 svx/source/svdraw/svdxcgv.cxx                       |    4 ++--
 13 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit b99c69784e8bb7b477759f14058a707e9000e56d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 29 16:27:18 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 30 09:46:37 2018 +0200

    rename GetMarkedObjModel to CreateMarkedObjModel
    
    and return std::unique_ptr
    
    Not that it helps much, the ownership quickly becomes complex once it
    hits the TransferableHelper.
    
    Change-Id: I3c6bd72072e092b71b32e4105fe859fdcea956af
    Reviewed-on: https://gerrit.libreoffice.org/59777
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 90660c07e1cb..9ace159756e1 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -63,7 +63,7 @@ ChartTransferable::ChartTransferable(
     m_xMetaFileGraphic.set( aGraphic.GetXGraphic());
     if ( m_bDrawing )
     {
-        m_pMarkedObjModel = pExchgView->GetMarkedObjModel();
+        m_pMarkedObjModel = pExchgView->CreateMarkedObjModel().release();
     }
 }
 
diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx
index 52dc63b1a282..731c9a392f53 100644
--- a/include/svx/svdxcgv.hxx
+++ b/include/svx/svdxcgv.hxx
@@ -70,7 +70,7 @@ public:
     // the page-local layer is merged. If there's no more room left for
     // additional page-local layers, the corresponding objects are assigned
     // the default layer (layer 0, document-global standard layer).
-    virtual SdrModel*   GetMarkedObjModel() const;
+    virtual std::unique_ptr<SdrModel> CreateMarkedObjModel() const;
 
     Graphic         GetAllMarkedGraphic() const;
 
diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx
index 33a19fa79061..9b92023e5596 100644
--- a/include/svx/view3d.hxx
+++ b/include/svx/view3d.hxx
@@ -83,7 +83,7 @@ public:
     const MouseEvent& GetMouseEvent() { return aMouseEvent; }
 
     // Override getting the model, as we need to supply a Scene together with individual 3D Objects.
-    virtual SdrModel* GetMarkedObjModel() const override;
+    virtual std::unique_ptr<SdrModel> CreateMarkedObjModel() const override;
 
     // On Paste: We need to insert the objects of the Scene, but not the Scene itself
     using SdrView::Paste;
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index c42134bb28cd..5b5aca2a4a7b 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -327,7 +327,7 @@ void ScSelectionTransferObj::CreateDrawData()
             }
 
             ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() );
-            std::unique_ptr<SdrModel> pModel(pDrawView->GetMarkedObjModel());
+            std::unique_ptr<SdrModel> pModel(pDrawView->CreateMarkedObjModel());
             ScDrawLayer::SetGlobalDrawPersist(nullptr);
 
             ScViewData& rViewData = pView->GetViewData();
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index ecaecee72982..ad7ea280d8c7 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1253,7 +1253,7 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
             SdrPageView* pPV = aEditView.GetSdrPageView();
             aEditView.MarkObj(pObject, pPV);
 
-            std::unique_ptr<SdrModel> pDragModel(aEditView.GetMarkedObjModel());
+            std::unique_ptr<SdrModel> pDragModel(aEditView.CreateMarkedObjModel());
 
             TransferableObjectDescriptor aObjDesc;
             pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 4bd6b11719cf..ae640d7f1708 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -80,7 +80,7 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos )
             aDragShellRef->DoInitNew();
         }
         ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() );
-        std::unique_ptr<SdrModel> pModel(GetMarkedObjModel());
+        std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
         ScDrawLayer::SetGlobalDrawPersist(nullptr);
 
         //  Charts now always copy their data in addition to the source reference, so
@@ -353,12 +353,12 @@ void ScDrawView::DoCopy()
     if (ScGlobal::xDrawClipDocShellRef.is() && !aRanges.empty())
     {
         // Copy data referenced by the chart objects to the draw clip
-        // document. We need to do this before GetMarkedObjModel() below.
+        // document. We need to do this before CreateMarkedObjModel() below.
         ScDocShellRef xDocSh = ScGlobal::xDrawClipDocShellRef;
         ScDocument& rClipDoc = xDocSh->GetDocument();
         copyChartRefDataToClipDoc(pDoc, &rClipDoc, aRanges);
     }
-    std::unique_ptr<SdrModel> pModel(GetMarkedObjModel());
+    std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
     ScDrawLayer::SetGlobalDrawPersist(nullptr);
 
     //  Charts now always copy their data in addition to the source reference, so
@@ -392,7 +392,7 @@ uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable()
 
     // update ScGlobal::xDrawClipDocShellRef
     ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
-    std::unique_ptr<SdrModel> pModel( GetMarkedObjModel() );
+    std::unique_ptr<SdrModel> pModel( CreateMarkedObjModel() );
     ScDrawLayer::SetGlobalDrawPersist(nullptr);
 
     //  Charts now always copy their data in addition to the source reference, so
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 186a036eede5..056fb2953f49 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1098,7 +1098,7 @@ bool SdDrawDocument::InsertBookmarkAsObject(
         if (bOLEObjFound)
             pBMView->GetDoc().SetAllocDocSh(true);
 
-        SdDrawDocument* pTmpDoc = static_cast<SdDrawDocument*>( pBMView->GetMarkedObjModel() );
+        SdDrawDocument* pTmpDoc = static_cast<SdDrawDocument*>( pBMView->CreateMarkedObjModel().release() );
         bOK = pView->Paste(*pTmpDoc, aObjPos, pPage, SdrInsertFlags::NONE);
 
         if (bOLEObjFound)
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 2df04fd50038..1fc338954cae 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -272,7 +272,7 @@ void SdTransferable::CreateData()
 
         if( mpSourceDoc )
             mpSourceDoc->CreatingDataObj(this);
-        mpSdDrawDocumentIntern = static_cast<SdDrawDocument*>( mpSdView->GetMarkedObjModel() );
+        mpSdDrawDocumentIntern = static_cast<SdDrawDocument*>( mpSdView->CreateMarkedObjModel().release() );
         if( mpSourceDoc )
             mpSourceDoc->CreatingDataObj(nullptr);
 
@@ -494,7 +494,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
             {
                 SdDrawDocument& rInternDoc = mpSdViewIntern->GetDoc();
                 rInternDoc.CreatingDataObj(this);
-                SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( mpSdViewIntern->GetMarkedObjModel() );
+                SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( mpSdViewIntern->CreateMarkedObjModel().release() );
                 rInternDoc.CreatingDataObj(nullptr);
 
                 bOK = SetObject( pDoc, SDTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 539d69b4dfc4..a714d10cca33 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -92,7 +92,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat
     SD_MOD()->pTransferClip = pTransferable;
 
     mrDoc.CreatingDataObj( pTransferable );
-    pTransferable->SetWorkDocument( static_cast<SdDrawDocument*>(GetMarkedObjModel()) );
+    pTransferable->SetWorkDocument( static_cast<SdDrawDocument*>(CreateMarkedObjModel().release()) );
     mrDoc.CreatingDataObj( nullptr );
 
     // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index a710e7325ec4..1245065e6814 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -622,7 +622,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     // model is owned by from AllocModel() created DocShell
                     SdDrawDocument* pSourceDoc = static_cast<SdDrawDocument*>( pSourceView->GetModel() );
                     pSourceDoc->CreatingDataObj( pOwnData );
-                    SdDrawDocument* pModel = static_cast<SdDrawDocument*>( pSourceView->GetMarkedObjModel() );
+                    SdDrawDocument* pModel = static_cast<SdDrawDocument*>( pSourceView->CreateMarkedObjModel().release() );
                     bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions);
 
                     if( !pPage )
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index e976aab5962d..eecae287517a 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -333,7 +333,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
 // override get model, since in some 3D objects an additional scene
 // must be pushed in
 
-SdrModel* E3dView::GetMarkedObjModel() const
+std::unique_ptr<SdrModel> E3dView::CreateMarkedObjModel() const
 {
     // Does 3D objects exist which scenes are not selected?
     bool bSpecialHandling(false);
@@ -371,10 +371,10 @@ SdrModel* E3dView::GetMarkedObjModel() const
     if(!bSpecialHandling)
     {
         // call parent
-        return SdrView::GetMarkedObjModel();
+        return SdrView::CreateMarkedObjModel();
     }
 
-    SdrModel* pNewModelel = nullptr;
+    std::unique_ptr<SdrModel> pNewModel;
     tools::Rectangle aSelectedSnapRect;
 
     // set 3d selection flags at all directly selected objects
@@ -415,13 +415,13 @@ SdrModel* E3dView::GetMarkedObjModel() const
 
     // call parent. This will copy all scenes and the selection flags at the 3D objects. So
     // it will be possible to delete all non-selected 3d objects from the cloned 3d scenes
-    pNewModelel = SdrView::GetMarkedObjModel();
+    pNewModel = SdrView::CreateMarkedObjModel();
 
-    if(pNewModelel)
+    if(pNewModel)
     {
-        for(sal_uInt16 nPg(0); nPg < pNewModelel->GetPageCount(); nPg++)
+        for(sal_uInt16 nPg(0); nPg < pNewModel->GetPageCount(); nPg++)
         {
-            const SdrPage* pSrcPg=pNewModelel->GetPage(nPg);
+            const SdrPage* pSrcPg=pNewModel->GetPage(nPg);
             const size_t nObjCount(pSrcPg->GetObjCount());
 
             for(size_t nOb = 0; nOb < nObjCount; ++nOb)
@@ -446,7 +446,7 @@ SdrModel* E3dView::GetMarkedObjModel() const
     // restore old selection
     rCurrentMarkList = aOldML;
 
-    return pNewModelel;
+    return pNewModel;
 }
 
 // When pasting objects have to integrated if a scene is inserted, but
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index aefd4955a680..369c66c315ff 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -191,7 +191,7 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
     // and then the object connections are made.
     // Similar implementation are setup as the following:
     //    void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
-    //    SdrModel* SdrExchangeView::GetMarkedObjModel() const
+    //    SdrModel* SdrExchangeView::CreateMarkedObjModel() const
     //    BOOL SdrExchangeView::Paste(const SdrModel& rMod,...)
     //    void SdrEditView::CopyMarked()
     if (nCloneErrCnt==0) {
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index f549df42426e..c722484602aa 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -709,12 +709,12 @@ void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const
     }
 }
 
-SdrModel* SdrExchangeView::GetMarkedObjModel() const
+std::unique_ptr<SdrModel> SdrExchangeView::CreateMarkedObjModel() const
 {
     // Sorting the MarkList here might be problematic in the future, so
     // use a copy.
     SortMarkedObjects();
-    SdrModel* pNewModel(mpModel->AllocModel());
+    std::unique_ptr<SdrModel> pNewModel(mpModel->AllocModel());
     SdrPage* pNewPage(pNewModel->AllocPage(false));
     pNewModel->InsertPage(pNewPage);
     ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects());


More information about the Libreoffice-commits mailing list