[Libreoffice-commits] core.git: 2 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 06:20:58 UTC 2018


 sw/source/ui/frmdlg/column.cxx  |   47 +++++++++++++++++++---------------------
 sw/source/uibase/inc/column.hxx |    8 +++---
 2 files changed, 27 insertions(+), 28 deletions(-)

New commits:
commit aa8182383eaf25e296c4c104c63feb164f90e426
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 26 16:16:37 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:20:43 2018 +0200

    loplugin:useuniqueptr in SwColumnPage
    
    Change-Id: I36cd9ba0c64073ae09d8ab8e2119d1404cbb02f1
    Reviewed-on: https://gerrit.libreoffice.org/58236
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 16aa1ed8420c..8232edfca584 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -382,7 +382,7 @@ void SwColumnPage::ResetColWidth()
 {
     if( m_nCols )
     {
-        const sal_uInt16 nWidth = GetMaxWidth( m_pColMgr, m_nCols ) / m_nCols;
+        const sal_uInt16 nWidth = GetMaxWidth( m_pColMgr.get(), m_nCols ) / m_nCols;
 
         for(sal_uInt16 i = 0; i < m_nCols; ++i)
             m_nColWidth[i] = static_cast<long>(nWidth);
@@ -523,7 +523,7 @@ SwColumnPage::~SwColumnPage()
 
 void SwColumnPage::dispose()
 {
-    delete m_pColMgr;
+    m_pColMgr.reset();
     m_pCLNrEdt.clear();
     m_pDefaultVS.clear();
     m_pBalanceColsCB.clear();
@@ -589,8 +589,7 @@ void SwColumnPage::Reset(const SfxItemSet *rSet)
     m_aDistEd1.SetPrcntValue(50, FUNIT_CM);
     m_aDistEd2.SetPrcntValue(50, FUNIT_CM);
 
-    delete m_pColMgr;
-    m_pColMgr = new SwColMgr(*rSet);
+    m_pColMgr.reset(new SwColMgr(*rSet));
     m_nCols   = m_pColMgr->GetCount() ;
     m_pCLNrEdt->SetMax(std::max(static_cast<sal_uInt16>(m_pCLNrEdt->GetMax()), m_nCols));
     m_pCLNrEdt->SetLast(std::max(m_nCols,static_cast<sal_uInt16>(m_pCLNrEdt->GetMax())));
@@ -1244,7 +1243,7 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet)
             }
         }
         m_pFrameExampleWN->Hide();
-        m_pPgeExampleWN->UpdateExample( rSet, m_pColMgr );
+        m_pPgeExampleWN->UpdateExample( rSet, m_pColMgr.get() );
         m_pPgeExampleWN->Show();
 
     }
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index 2f1b911ac35a..b72bc00180d6 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -121,7 +121,7 @@ class SwColumnPage : public SfxTabPage
     VclPtr<SwColExample>   m_pPgeExampleWN;
     VclPtr<SwColumnOnlyExample> m_pFrameExampleWN;
 
-    SwColMgr*       m_pColMgr;
+    std::unique_ptr<SwColMgr> m_pColMgr;
 
     sal_uInt16          m_nFirstVis;
     sal_uInt16          m_nCols;
commit 6645a78104da18e23e476218343161c62dbc6a40
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 26 16:14:16 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:20:36 2018 +0200

    loplugin:useuniqueptr in SwColumnDlg
    
    Change-Id: I115ee37ce3fffa26bbaf011ae2c5aa3427059b5e
    Reviewed-on: https://gerrit.libreoffice.org/58235
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 37736e641ab7..16aa1ed8420c 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -115,17 +115,17 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh)
         m_nSelectionWidth = rSh.GetSectionWidth(*pCurrSection->GetFormat());
         if ( !m_nSelectionWidth )
             m_nSelectionWidth = USHRT_MAX;
-        m_pSectionSet = new SfxItemSet( m_rWrtShell.GetAttrPool(), aSectIds );
+        m_pSectionSet.reset( new SfxItemSet( m_rWrtShell.GetAttrPool(), aSectIds ) );
         m_pSectionSet->Put( pCurrSection->GetFormat()->GetAttrSet() );
-        pColPgSet = m_pSectionSet;
+        pColPgSet = m_pSectionSet.get();
     }
 
     if( m_rWrtShell.HasSelection() && m_rWrtShell.IsInsRegionAvailable() &&
         ( !pCurrSection || ( 1 != nFullSectCnt &&
             IsMarkInSameSection( m_rWrtShell, pCurrSection ) )))
     {
-        m_pSelectionSet = new SfxItemSet( m_rWrtShell.GetAttrPool(), aSectIds );
-        pColPgSet = m_pSelectionSet;
+        m_pSelectionSet.reset( new SfxItemSet( m_rWrtShell.GetAttrPool(), aSectIds ) );
+        pColPgSet = m_pSelectionSet.get();
     }
 
     if( m_rWrtShell.GetFlyFrameFormat() )
@@ -140,12 +140,12 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh)
     const SwPageDesc* pPageDesc = m_rWrtShell.GetSelectedPageDescs();
     if( pPageDesc )
     {
-        m_pPageSet = new SfxItemSet(
+        m_pPageSet.reset( new SfxItemSet(
             m_rWrtShell.GetAttrPool(),
             svl::Items<
                 RES_FRM_SIZE, RES_FRM_SIZE,
                 RES_LR_SPACE, RES_LR_SPACE,
-                RES_COL, RES_COL>{});
+                RES_COL, RES_COL>{}) );
 
         const SwFrameFormat &rFormat = pPageDesc->GetMaster();
         m_nPageWidth = rFormat.GetFrameSize().GetSize().Width();
@@ -156,7 +156,7 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh)
 
         m_pPageSet->Put(rFormat.GetCol());
         m_pPageSet->Put(rFormat.GetLRSpace());
-        pColPgSet = m_pPageSet;
+        pColPgSet = m_pPageSet.get();
     }
 
     assert(pColPgSet);
@@ -221,9 +221,9 @@ SwColumnDlg::~SwColumnDlg()
 void SwColumnDlg::dispose()
 {
     m_pTabPage.disposeAndClear();
-    delete m_pPageSet;
-    delete m_pSectionSet;
-    delete m_pSelectionSet;
+    m_pPageSet.reset();
+    m_pSectionSet.reset();
+    m_pSelectionSet.reset();
     m_pApplyToLB.clear();
     SfxModalDialog::dispose();
 }
@@ -246,18 +246,18 @@ void SwColumnDlg::ObjectHdl(ListBox const * pBox)
     switch(m_nOldSelection)
     {
         case LISTBOX_SELECTION  :
-            pSet = m_pSelectionSet;
+            pSet = m_pSelectionSet.get();
             if( m_pSelectionSet )
                 pSet->Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth, nWidth));
         break;
         case LISTBOX_SECTION    :
         case LISTBOX_SECTIONS   :
-            pSet = m_pSectionSet;
+            pSet = m_pSectionSet.get();
             pSet->Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth, nWidth));
         break;
         case LISTBOX_PAGE       :
             nWidth = m_nPageWidth;
-            pSet = m_pPageSet;
+            pSet = m_pPageSet.get();
             pSet->Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth, nWidth));
         break;
         case LISTBOX_FRAME:
@@ -265,7 +265,7 @@ void SwColumnDlg::ObjectHdl(ListBox const * pBox)
         break;
     }
 
-    bool bIsSection = pSet == m_pSectionSet || pSet == m_pSelectionSet;
+    bool bIsSection = pSet == m_pSectionSet.get() || pSet == m_pSelectionSet.get();
     m_pTabPage->ShowBalance(bIsSection);
     m_pTabPage->SetInSection(bIsSection);
     m_pTabPage->SetFrameMode(true);
@@ -296,7 +296,7 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void)
         const SwSectionFormat* pFormat = pCurrSection->GetFormat();
         const size_t nNewPos = m_rWrtShell.GetSectionFormatPos( *pFormat );
         SwSectionData aData(*pCurrSection);
-        m_rWrtShell.UpdateSection( nNewPos, aData, m_pSectionSet );
+        m_rWrtShell.UpdateSection( nNewPos, aData, m_pSectionSet.get() );
     }
 
     if(m_pSectionSet && m_pSectionSet->Count() && m_bSelSectionChanged )
@@ -339,18 +339,18 @@ SfxItemSet* SwColumnDlg::EvalCurrentSelection(void)
     switch(m_nOldSelection)
     {
         case LISTBOX_SELECTION  :
-            pSet = m_pSelectionSet;
+            pSet = m_pSelectionSet.get();
         break;
         case LISTBOX_SECTION    :
-            pSet = m_pSectionSet;
+            pSet = m_pSectionSet.get();
             m_bSectionChanged = true;
         break;
         case LISTBOX_SECTIONS   :
-            pSet = m_pSectionSet;
+            pSet = m_pSectionSet.get();
             m_bSelSectionChanged = true;
         break;
         case LISTBOX_PAGE       :
-            pSet = m_pPageSet;
+            pSet = m_pPageSet.get();
             m_bPageChanged = true;
         break;
         case LISTBOX_FRAME:
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index 0fc5e983e5b1..2f1b911ac35a 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -48,9 +48,9 @@ class SwColumnDlg : public SfxModalDialog
 
     SwWrtShell&         m_rWrtShell;
     VclPtr<SwColumnPage>       m_pTabPage;
-    SfxItemSet*         m_pPageSet;
-    SfxItemSet*         m_pSectionSet;
-    SfxItemSet*         m_pSelectionSet;
+    std::unique_ptr<SfxItemSet> m_pPageSet;
+    std::unique_ptr<SfxItemSet> m_pSectionSet;
+    std::unique_ptr<SfxItemSet> m_pSelectionSet;
     SfxItemSet*         m_pFrameSet;
 
     long                m_nOldSelection;


More information about the Libreoffice-commits mailing list