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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 14 14:49:08 UTC 2018


 include/svx/fontworkbar.hxx             |    2 +-
 include/svx/fontworkgallery.hxx         |    4 ++--
 sc/source/ui/drawfunc/drawsh5.cxx       |    2 +-
 sc/source/ui/view/tabvwshb.cxx          |    2 +-
 sd/source/ui/view/drviews2.cxx          |    4 ++--
 svx/source/tbxctrls/fontworkgallery.cxx |   18 +++++++++---------
 svx/source/toolbars/fontworkbar.cxx     |   30 +++++++++++++++---------------
 sw/source/uibase/shells/drawsh.cxx      |    2 +-
 sw/source/uibase/uiview/viewdraw.cxx    |    4 ++--
 9 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 2dfe7702a08e74a140f2e55f1625ab780f0e8c2a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 14 13:22:17 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 14 15:48:43 2018 +0100

    coverity#1441522 FontWorkGalleryDialog mpSdrView member is never null
    
    Change-Id: If17d2984831b0881d39101648206accdadde12aa
    Reviewed-on: https://gerrit.libreoffice.org/65163
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/fontworkbar.hxx b/include/svx/fontworkbar.hxx
index c9f0b78bb17a..678ae8903cb7 100644
--- a/include/svx/fontworkbar.hxx
+++ b/include/svx/fontworkbar.hxx
@@ -48,7 +48,7 @@ public:
     FontworkBar(SfxViewShell* pViewShell);
     virtual ~FontworkBar() override;
 
-    static void execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindings& rBindings );
+    static void execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindings& rBindings );
     static void getState( SdrView const * pSdrView, SfxItemSet& rSet );
 };
 
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 610b0ad96452..0c04001cd8f7 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -51,7 +51,7 @@ public:
 class SAL_WARN_UNUSED SVX_DLLPUBLIC FontWorkGalleryDialog : public weld::GenericDialogController
 {
     sal_uInt16          mnThemeId;
-    SdrView*            mpSdrView;
+    SdrView&            mrSdrView;
 
     SdrObject**         mppSdrObject;
     SdrModel*           mpDestModel;
@@ -70,7 +70,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FontWorkGalleryDialog : public weld::Generic
     DECL_LINK(ClickOKHdl, weld::Button&, void );
 
 public:
-    FontWorkGalleryDialog(weld::Window* pParent, SdrView* pView);
+    FontWorkGalleryDialog(weld::Window* pParent, SdrView& rView);
     virtual ~FontWorkGalleryDialog() override;
 
     // SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 4c08816a940e..f2a36a37ee6c 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -606,7 +606,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
         case SID_FONTWORK_ALIGNMENT_FLOATER:
         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
-            svx::FontworkBar::execute( pView, rReq, rBindings );
+            svx::FontworkBar::execute( *pView, rReq, rBindings );
             rReq.Ignore ();
             break;
 
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 5ea064f7fdd3..44861192705c 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -470,7 +470,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
             break;
 
         case SID_FONTWORK_GALLERY_FLOATER:
-            svx::FontworkBar::execute( pView, rReq, GetViewFrame()->GetBindings() );
+            svx::FontworkBar::execute(*pView, rReq, GetViewFrame()->GetBindings());
             rReq.Ignore();
             break;
     }
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 57cbcfda0424..1a5d520cd9b1 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1284,7 +1284,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_DRAW_FONTWORK:
         case SID_DRAW_FONTWORK_VERTICAL:
         {
-            svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() );       // SJ: can be removed  (I think)
+            svx::FontworkBar::execute(*mpView, rReq, GetViewFrame()->GetBindings());       // SJ: can be removed  (I think)
             Cancel();
             rReq.Done();
         }
@@ -3103,7 +3103,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
         case SID_FONTWORK_ALIGNMENT_FLOATER:
         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
-            svx::FontworkBar::execute( mpDrawView.get(), rReq, GetViewFrame()->GetBindings() );
+            svx::FontworkBar::execute(*mpDrawView, rReq, GetViewFrame()->GetBindings());
             Cancel();
             rReq.Ignore ();
             break;
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 3b88ab1d78c7..b21db9d4220d 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -65,10 +65,10 @@ namespace svx
 const int nColCount = 4;
 const int nLineCount = 4;
 
-FontWorkGalleryDialog::FontWorkGalleryDialog(weld::Window* pParent, SdrView* pSdrView)
+FontWorkGalleryDialog::FontWorkGalleryDialog(weld::Window* pParent, SdrView& rSdrView)
     : GenericDialogController(pParent, "svx/ui/fontworkgallerydialog.ui", "FontworkGalleryDialog")
     , mnThemeId(0xffff)
-    , mpSdrView(pSdrView)
+    , mrSdrView(rSdrView)
     , mppSdrObject(nullptr)
     , mpDestModel(nullptr)
     , maCtlFavorites(m_xBuilder->weld_scrolled_window("ctlFavoriteswin"))
@@ -191,20 +191,20 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
                 // only caller of ::SetSdrObjectRef. Only in that case mpDestModel seems
                 // to be the correct target SdrModel.
                 // If this is not used, the correct SdrModel seems to be the one from
-                // the mpSdrView that is used to insert (InsertObjectAtView below) the
+                // the mrSdrView that is used to insert (InsertObjectAtView below) the
                 // cloned SdrObject.
                 const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
-                const bool bSdrViewInsertMode(nullptr != mpSdrView);
+                const bool bSdrViewInsertMode(true);
 
                 // center shape on current view
-                OutputDevice* pOutDev(mpSdrView->GetFirstOutputDevice());
+                OutputDevice* pOutDev(mrSdrView.GetFirstOutputDevice());
 
                 if(pOutDev && (bUseSpecialCalcMode || bSdrViewInsertMode))
                 {
                     // Clone directly to target SdrModel (may be different due to user/caller (!))
                     SdrObject* pNewObject(
                         pPage->GetObj(0)->CloneSdrObject(
-                            bUseSpecialCalcMode ? *mpDestModel : mpSdrView->getSdrModelFromSdrView()));
+                            bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView()));
 
                     // tdf#117629
                     // Since the 'old' ::CloneSdrObject also copies the SdrPage* the
@@ -232,11 +232,11 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
                     }
                     else // bSdrViewInsertMode
                     {
-                        SdrPageView* pPV(mpSdrView->GetSdrPageView());
+                        SdrPageView* pPV(mrSdrView.GetSdrPageView());
 
-                        if(nullptr != pPV)
+                        if (nullptr != pPV)
                         {
-                            mpSdrView->InsertObjectAtView( pNewObject, *pPV );
+                            mrSdrView.InsertObjectAtView( pNewObject, *pPV );
                         }
                         else
                         {
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 1ccc28761a7d..920475fb1adf 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -406,7 +406,7 @@ static void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem
 }
 
 
-void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindings& rBindings )
+void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindings& rBindings )
 {
     const char* pStrResId = nullptr;
 
@@ -415,7 +415,7 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin
     {
         case SID_FONTWORK_GALLERY_FLOATER:
         {
-            FontWorkGalleryDialog aDlg(rReq.GetFrameWeld(), pSdrView);
+            FontWorkGalleryDialog aDlg(rReq.GetFrameWeld(), rSdrView);
             aDlg.run();
         }
         break;
@@ -431,20 +431,20 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin
             }
             if ( !aCustomShape.isEmpty() )
             {
-                const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+                const SdrMarkList& rMarkList = rSdrView.GetMarkedObjectList();
                 const size_t nCount = rMarkList.GetMarkCount();
                 for( size_t i = 0; i < nCount; ++i )
                 {
                     SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
                     if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=  nullptr )
                     {
-                        const bool bUndo = pSdrView->IsUndoEnabled();
+                        const bool bUndo = rSdrView.IsUndoEnabled();
 
                         if( bUndo )
                         {
                             OUString aStr( SvxResId( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
-                            pSdrView->BegUndo( aStr );
-                            pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
+                            rSdrView.BegUndo(aStr);
+                            rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
                         }
                         SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
                         GetGeometryForCustomShape( aGeometryItem, aCustomShape );
@@ -459,9 +459,9 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin
                         }
 
                         pObj->BroadcastObjectChange();
-                        if( bUndo )
-                            pSdrView->EndUndo();
-                        pSdrView->AdjustMarkHdl(); //HMH sal_True );
+                        if (bUndo)
+                            rSdrView.EndUndo();
+                        rSdrView.AdjustMarkHdl(); //HMH sal_True );
                         rBindings.Invalidate( SID_FONTWORK_SHAPE_TYPE );
                     }
                 }
@@ -510,26 +510,26 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin
             if ( !pStrResId )
                 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
 
-            const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+            const SdrMarkList& rMarkList = rSdrView.GetMarkedObjectList();
             const size_t nCount = rMarkList.GetMarkCount();
             for( size_t i = 0; i < nCount; ++i )
             {
                 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
                 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=  nullptr )
                 {
-                    const bool bUndo = pSdrView->IsUndoEnabled();
+                    const bool bUndo = rSdrView.IsUndoEnabled();
                     if( bUndo )
                     {
                         OUString aStr( SvxResId( pStrResId ) );
-                        pSdrView->BegUndo( aStr );
-                        pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
+                        rSdrView.BegUndo(aStr);
+                        rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
                     }
                     SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
                     impl_execute( rReq, aGeometryItem, pObj );
                     pObj->SetMergedItem( aGeometryItem );
                     pObj->BroadcastObjectChange();
-                    if( bUndo )
-                        pSdrView->EndUndo();
+                    if (bUndo)
+                        rSdrView.EndUndo();
                 }
             }
         }
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 073474ffb498..ef437cb942ec 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -341,7 +341,7 @@ void SwDrawShell::Execute(SfxRequest &rReq)
         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
         case SID_FONTWORK_ALIGNMENT_FLOATER:
         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
-            svx::FontworkBar::execute( pSdrView, rReq, rBnd );
+            svx::FontworkBar::execute(*pSdrView, rReq, rBnd);
             rReq.Ignore ();
             break;
 
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 8420e9f3a9f5..ca7884c5cf2b 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -152,10 +152,10 @@ void SwView::ExecDraw(SfxRequest& rReq)
             m_pWrtShell->MakeDrawView();
 
         pSdrView = m_pWrtShell->GetDrawView();
-        if ( pSdrView )
+        if (pSdrView)
         {
             SdrObject* pObj = nullptr;
-            svx::FontWorkGalleryDialog aDlg(rWin.GetFrameWeld(), pSdrView);
+            svx::FontWorkGalleryDialog aDlg(rWin.GetFrameWeld(), *pSdrView);
             aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() );
             aDlg.run();
             if ( pObj )


More information about the Libreoffice-commits mailing list