[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 31 06:22:42 UTC 2018


 sc/source/ui/docshell/docsh5.cxx |    8 ++++----
 sc/source/ui/inc/undodat.hxx     |    4 ++--
 sc/source/ui/undo/undodat.cxx    |   10 +++++-----
 sc/source/ui/view/viewfun3.cxx   |    8 ++++----
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 418e6419219a7ffa61b7400abbbcec6a6a93b91f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 30 10:49:19 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 31 08:22:18 2018 +0200

    pass ScDocument by ScDocumentUniquePtr
    
    Change-Id: I6ce82c6f061c7f01a5584230c26e9bf20c7f07ca
    Reviewed-on: https://gerrit.libreoffice.org/59788
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 32f842080a0a..95106e21676f 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -577,7 +577,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
             ScOutlineTable* pTable = m_aDocument.GetOutlineTable( nDestTab );
             ScOutlineTable* pUndoTab = pTable ? new ScOutlineTable( *pTable ) : nullptr;
 
-            ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+            ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
             pUndoDoc->InitUndo( &m_aDocument, 0, nTabCount-1, false, true );
 
             // row state
@@ -598,12 +598,12 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
                 m_aDocument.CopyToDocument(aOldDest, InsertDeleteFlags::ALL, false, *pUndoDoc);
 
             GetUndoManager()->AddUndoAction(
-                    new ScUndoConsolidate( this, aDestArea, rParam, pUndoDoc,
+                    new ScUndoConsolidate( this, aDestArea, rParam, std::move(pUndoDoc),
                                             true, nInsertCount, pUndoTab, pUndoData ) );
         }
         else
         {
-            ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+            ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
             pUndoDoc->InitUndo( &m_aDocument, aDestArea.nTab, aDestArea.nTab );
 
             m_aDocument.CopyToDocument(aDestArea.nColStart, aDestArea.nRowStart, aDestArea.nTab,
@@ -615,7 +615,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
                 m_aDocument.CopyToDocument(aOldDest, InsertDeleteFlags::ALL, false, *pUndoDoc);
 
             GetUndoManager()->AddUndoAction(
-                    new ScUndoConsolidate( this, aDestArea, rParam, pUndoDoc,
+                    new ScUndoConsolidate( this, aDestArea, rParam, std::move(pUndoDoc),
                                             false, 0, nullptr, pUndoData ) );
         }
     }
diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx
index edb6599f6319..2464f098b8e3 100644
--- a/sc/source/ui/inc/undodat.hxx
+++ b/sc/source/ui/inc/undodat.hxx
@@ -370,7 +370,7 @@ class ScUndoConsolidate: public ScSimpleUndo
 public:
     ScUndoConsolidate(ScDocShell* pNewDocShell,
                       const ScArea& rArea, const ScConsolidateParam& rPar,
-                      ScDocument* pNewUndoDoc, bool bReference,
+                      ScDocumentUniquePtr pNewUndoDoc, bool bReference,
                       SCROW nInsCount, ScOutlineTable* pTab,
                       ScDBData* pData);
 
@@ -430,7 +430,7 @@ public:
                    SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
                    SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
                    const ScMarkData& rMark,
-                   ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
+                   ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
                    std::unique_ptr<ScRefUndoData> pRefData);
     virtual void    Undo() override;
     virtual void    Redo() override;
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 9f2a204e6b5b..f258c8ecfdf1 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1523,12 +1523,12 @@ bool ScUndoDataPilot::CanRepeat(SfxRepeatTarget& /* rTarget */) const
 }
 
 ScUndoConsolidate::ScUndoConsolidate( ScDocShell* pNewDocShell, const ScArea& rArea,
-                    const ScConsolidateParam& rPar, ScDocument* pNewUndoDoc,
+                    const ScConsolidateParam& rPar, ScDocumentUniquePtr pNewUndoDoc,
                     bool bReference, SCROW nInsCount, ScOutlineTable* pTab,
                     ScDBData* pData )
     : ScSimpleUndo(pNewDocShell)
     , aDestArea(rArea)
-    , xUndoDoc(pNewUndoDoc)
+    , xUndoDoc(std::move(pNewUndoDoc))
     , aParam(rPar)
     , bInsRef(bReference)
     , nInsertCount(nInsCount)
@@ -1732,12 +1732,12 @@ ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell,
                                 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
                                 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
                                 const ScMarkData& rMark,
-                                ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
+                                ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
                                 std::unique_ptr<ScRefUndoData> pRefData )
     : ScBlockUndo(pNewDocShell, ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ), SC_UNDO_SIMPLE)
     , mxMarkData(new ScMarkData(rMark))
-    , xUndoDoc(pNewUndoDoc)
-    , xRedoDoc(pNewRedoDoc)
+    , xUndoDoc(std::move(pNewUndoDoc))
+    , xRedoDoc(std::move(pNewRedoDoc))
     , xRefUndoData(std::move(pRefData))
     , bRedoFilled(false)
 {
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index c633df4e82ee..7ae86f3d0c93 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1957,8 +1957,8 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
     if ( pDoc )
     {
         const bool bRecord( pDoc->IsUndoEnabled());
-        ScDocument* pUndoDoc = nullptr;
-        ScDocument* pRedoDoc = nullptr;
+        ScDocumentUniquePtr pUndoDoc;
+        ScDocumentUniquePtr pRedoDoc;
         std::unique_ptr<ScRefUndoData> pUndoData;
         SCTAB nTab = GetViewData().GetTabNo();
         SCTAB nStartTab = nTab;
@@ -1977,7 +1977,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
 
         if ( bRecord )
         {
-            pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+            pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
             pUndoDoc->InitUndoSelected( pDoc , rMark , bColInfo , bRowInfo );
             pDoc->CopyToDocument( aUserRange , InsertDeleteFlags::VALUE , false, *pUndoDoc );
         }
@@ -1997,7 +1997,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
         SfxUndoAction* pUndo = new ScUndoDataForm( pDocSh,
                                                    nStartCol, nCurrentRow, nStartTab,
                                                    nUndoEndCol, nUndoEndRow, nEndTab, rMark,
-                                                   pUndoDoc, pRedoDoc,
+                                                   std::move(pUndoDoc), std::move(pRedoDoc),
                                                    std::move(pUndoData) );
         pUndoMgr->AddUndoAction( new ScUndoWrapper( pUndo ), true );
 


More information about the Libreoffice-commits mailing list