[Libreoffice-commits] core.git: 2 commits - basctl/source include/sfx2 sc/source sfx2/source starmath/inc sw/inc sw/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 29 06:37:39 UTC 2018


 basctl/source/inc/basidesh.hxx |    2 +-
 include/sfx2/objsh.hxx         |    5 -----
 include/sfx2/viewsh.hxx        |    1 -
 sc/source/ui/inc/docsh.hxx     |    6 +++++-
 sc/source/ui/inc/prevwsh.hxx   |    2 +-
 sc/source/ui/inc/tabvwsh.hxx   |    2 +-
 sfx2/source/doc/objstor.cxx    |    6 ------
 sfx2/source/view/viewsh.cxx    |   10 ----------
 starmath/inc/view.hxx          |    2 +-
 sw/inc/numrule.hxx             |    2 +-
 sw/source/core/doc/number.cxx  |   34 ++++++++++++++--------------------
 11 files changed, 24 insertions(+), 48 deletions(-)

New commits:
commit 47ccda36fc80b40928b0e12e7dc1052ff0f98654
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Mar 28 21:12:37 2018 +0200

    loplugin:virtualdown in sfx2
    
    Change-Id: I51e79a4a3d2c799e69bc13c66b5b84056bee6206
    Reviewed-on: https://gerrit.libreoffice.org/52034
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 0362ad0bbcea..7d8398e4e0bc 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -104,7 +104,7 @@ private:
     static unsigned nShellCount;
 
 private:
-    virtual void        AdjustPosSizePixel( const Point &rPos, const Size &rSize ) override;
+    void                AdjustPosSizePixel( const Point &rPos, const Size &rSize );
     virtual void        OuterResizePixel( const Point &rPos, const Size &rSize ) override;
     sal_uInt16          InsertWindowInTable (BaseWindow* pNewWin);
     virtual bool        PrepareClose( bool bUI = true ) override;
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 1f3f085f85ac..a749d842ac2f 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -332,11 +332,6 @@ public:
                                     const css::uno::Reference< css::embed::XStorage >& xStorage );
     virtual void                UpdateLinks();
     virtual bool                LoadExternal( SfxMedium& rMedium );
-    /**
-     * Called when the Options dialog is dismissed with the OK button, to
-     * handle potentially conflicting option settings.
-     */
-    virtual void                CheckConfigOptions();
     bool                        IsConfigOptionsChecked() const;
     void                        SetConfigOptionsChecked( bool bChecked );
 
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 416b177a662b..19356714b329 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -235,7 +235,6 @@ public:
     vcl::Window*                GetWindow() const { return pWindow; }
     weld::Window*               GetFrameWeld() const;
     void                        SetWindow( vcl::Window *pViewPort );
-    virtual void                AdjustPosSizePixel( const Point &rOfs, const Size &rSize );
     const SvBorder&             GetBorderPixel() const;
     void                        SetBorderPixel( const SvBorder &rBorder );
     void                        InvalidateBorder();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 197ca4684c4e..dd0c026e8726 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -295,7 +295,11 @@ public:
     void            ReloadTabLinks();
 
     void            SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoading = false );
-    virtual void    CheckConfigOptions() override;
+    /**
+     * Called when the Options dialog is dismissed with the OK button, to
+     * handle potentially conflicting option settings.
+     */
+    virtual void    CheckConfigOptions();
 
     void            PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos );
 
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index 14d2f613b464..fd484a619bab 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -62,7 +62,7 @@ private:
 
 protected:
     virtual void    Activate(bool bMDI) override;
-    virtual void    AdjustPosSizePixel( const Point &rPos, const Size &rSize ) override;
+    virtual void    AdjustPosSizePixel( const Point &rPos, const Size &rSize );
 
     virtual void    InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
     virtual void    OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index ae283f238735..8db44ce95f01 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -190,7 +190,7 @@ protected:
 
     virtual void    Move() override;     // notification
 
-    virtual void    AdjustPosSizePixel( const Point &rPos, const Size &rSize ) override;     // old
+    virtual void    AdjustPosSizePixel( const Point &rPos, const Size &rSize );     // old
 
     virtual void    InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override; // new
     virtual void    OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index e36a3c949c5b..f6c6e42b706a 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3521,12 +3521,6 @@ bool SfxObjectShell::InsertGeneratedStream(SfxMedium&,
     return false;
 }
 
-void SfxObjectShell::CheckConfigOptions()
-{
-    // not handled.  Each app's shell needs to overwrite this method to add handler.
-    SetConfigOptionsChecked(true);
-}
-
 bool SfxObjectShell::IsConfigOptionsChecked() const
 {
     return pImpl->m_bConfigOptionsChecked;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index defb4a6d9f91..681b24258a58 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -858,16 +858,6 @@ void SfxViewShell::Deactivate(bool /*bMDI*/)
 }
 
 
-void SfxViewShell::AdjustPosSizePixel
-(
-    const Point&    /*rToolOffset*/,// Upper left corner Tools in Frame-Window
-    const Size&     /*rSize*/       // All available sizes.
-)
-
-{
-}
-
-
 void SfxViewShell::Move()
 
 /*  [Description]
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index e530b47d839f..376de8a552ba 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -255,7 +255,7 @@ protected:
                                                       const SfxItemSet &rOptions) override;
     virtual void Deactivate(bool IsMDIActivate) override;
     virtual void Activate(bool IsMDIActivate) override;
-    virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize) override;
+    virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
     virtual void InnerResizePixel(const Point &rOfs, const Size  &rSize, bool inplaceEditModeChange) override;
     virtual void OuterResizePixel(const Point &rOfs, const Size  &rSize) override;
     virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const override;
commit 57871f98d30c0283969de1a41e72f5838d6c0eb0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Mar 28 11:12:20 2018 +0200

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

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index b1029c810a82..cdbfd9f5f252 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -113,7 +113,7 @@ private:
     static SwNumFormat* maLabelAlignmentBaseFormats [ RULE_END ][ MAXLEVEL ];
     static sal_uInt16 mnRefCount;
 
-    SwNumFormat* maFormats[ MAXLEVEL ];
+    std::unique_ptr<SwNumFormat> maFormats[ MAXLEVEL ];
 
     /** container for associated text nodes */
     tTextNodeList maTextNodeList;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 7a8574065a87..2b7047b57535 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -93,7 +93,7 @@ const SwNumFormat* SwNumRule::GetNumFormat( sal_uInt16 i ) const
     assert( i < MAXLEVEL && meRuleType < RULE_END );
     if ( i < MAXLEVEL && meRuleType < RULE_END)
     {
-        pResult = maFormats[ i ];
+        pResult = maFormats[ i ].get();
     }
 
     return pResult;
@@ -461,7 +461,6 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
       msDefaultListId( rNumRule.msDefaultListId )
 {
     ++mnRefCount;
-    memset( maFormats, 0, sizeof( maFormats ));
     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
         if( rNumRule.maFormats[ n ] )
             Set( n, *rNumRule.maFormats[ n ] );
@@ -469,8 +468,8 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
 
 SwNumRule::~SwNumRule()
 {
-    for(SwNumFormat* p : maFormats)
-        delete p;
+    for (auto & i : maFormats)
+        i.reset();
 
     if (mpNumRuleMap)
     {
@@ -515,7 +514,7 @@ SwNumRule::~SwNumRule()
 
 void SwNumRule::CheckCharFormats( SwDoc* pDoc )
 {
-    for(SwNumFormat*& rpNumFormat : maFormats)
+    for(auto& rpNumFormat : maFormats)
     {
         SwCharFormat* pFormat;
         if( rpNumFormat && nullptr != ( pFormat = rpNumFormat->GetCharFormat() ) &&
@@ -524,8 +523,7 @@ void SwNumRule::CheckCharFormats( SwDoc* pDoc )
             // copy
             SwNumFormat* pNew = new SwNumFormat( *rpNumFormat );
             pNew->SetCharFormat( pDoc->CopyCharFormat( *pFormat ) );
-            delete rpNumFormat;
-            rpNumFormat = pNew;
+            rpNumFormat.reset(pNew);
         }
     }
 }
@@ -535,7 +533,7 @@ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
     if( this != &rNumRule )
     {
         for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
-            Set( n, rNumRule.maFormats[ n ] );
+            Set( n, rNumRule.maFormats[ n ].get() );
 
         meRuleType = rNumRule.meRuleType;
         msName = rNumRule.msName;
@@ -580,8 +578,7 @@ void SwNumRule::Set( sal_uInt16 i, const SwNumFormat& rNumFormat )
     {
         if( !maFormats[ i ] || !(rNumFormat == Get( i )) )
         {
-            delete maFormats[ i ];
-            maFormats[ i ] = new SwNumFormat( rNumFormat );
+            maFormats[ i ].reset(new SwNumFormat( rNumFormat ));
             mbInvalidRuleFlag = true;
         }
     }
@@ -592,24 +589,22 @@ void SwNumRule::Set( sal_uInt16 i, const SwNumFormat* pNumFormat )
     OSL_ENSURE( i < MAXLEVEL, "Serious defect" );
     if( i >= MAXLEVEL )
         return;
-    SwNumFormat* pOld = maFormats[ i ];
-    if( !pOld )
+    if( !maFormats[ i ] )
     {
         if( pNumFormat )
         {
-            maFormats[ i ] = new SwNumFormat( *pNumFormat );
+            maFormats[ i ].reset(new SwNumFormat( *pNumFormat ));
             mbInvalidRuleFlag = true;
         }
     }
     else if( !pNumFormat )
     {
-        delete pOld;
-        maFormats[ i ] = nullptr;
+        maFormats[ i ].reset();
         mbInvalidRuleFlag = true;
     }
-    else if( *pOld != *pNumFormat )
+    else if( *maFormats[i] != *pNumFormat )
     {
-        *pOld = *pNumFormat;
+        *maFormats[ i ] = *pNumFormat;
         mbInvalidRuleFlag = true;
     }
 }
@@ -807,7 +802,7 @@ SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule )
 {
     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     {
-        Set( n, rNumRule.maFormats[ n ] );
+        Set( n, rNumRule.maFormats[ n ].get() );
         if( maFormats[ n ] && maFormats[ n ]->GetCharFormat() &&
             !pDoc->GetCharFormats()->IsAlive(maFormats[n]->GetCharFormat()))
         {
@@ -832,8 +827,7 @@ void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc)
     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     {
         const SvxNumberFormat* pSvxFormat = rNumRule.Get(n);
-        delete maFormats[n];
-        maFormats[n] = pSvxFormat ? new SwNumFormat(*pSvxFormat, pDoc) : nullptr;
+        maFormats[n].reset( pSvxFormat ? new SwNumFormat(*pSvxFormat, pDoc) : nullptr );
     }
 
     mbInvalidRuleFlag = true;


More information about the Libreoffice-commits mailing list