[Libreoffice-commits] core.git: 2 commits - include/svx sc/source svx/source
Caolán McNamara
caolanm at redhat.com
Sat Jan 24 07:34:28 PST 2015
include/svx/imapdlg.hxx | 12 +-----------
sc/source/ui/view/imapwrap.cxx | 10 ----------
sc/source/ui/view/imapwrap.hxx | 2 --
sc/source/ui/view/tabvwsh9.cxx | 7 ++++---
svx/source/dialog/imapdlg.cxx | 14 +++++++++++---
5 files changed, 16 insertions(+), 29 deletions(-)
New commits:
commit 533f390e609da2f4b0e644a543746a767f1bba62
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 24 15:19:59 2015 +0000
coverity#1265796 Dereference null return value
Change-Id: I779dacdb7fb18ba8148e932b4dc684d08f824cbe
diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx
index d4bbb7a..7c288fe 100644
--- a/include/svx/imapdlg.hxx
+++ b/include/svx/imapdlg.hxx
@@ -155,13 +155,7 @@ public:
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
};
-inline SvxIMapDlg* SVXIMAPDLG()
-{
- SfxChildWindow* pWnd = NULL;
- if (SfxViewFrame::Current() && SfxViewFrame::Current()->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()))
- pWnd = SfxViewFrame::Current()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
- return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : NULL;
-}
+SVX_DLLPUBLIC SvxIMapDlg* GetIMapDlg();
#endif // INCLUDED_SVX_IMAPDLG_HXX
diff --git a/sc/source/ui/view/imapwrap.cxx b/sc/source/ui/view/imapwrap.cxx
index ee2c8f8..423fb23 100644
--- a/sc/source/ui/view/imapwrap.cxx
+++ b/sc/source/ui/view/imapwrap.cxx
@@ -27,16 +27,6 @@ sal_uInt16 ScIMapChildWindowId()
return SvxIMapDlgChildWindow::GetChildWindowId();
}
-SvxIMapDlg* ScGetIMapDlg()
-{
- //! pass view frame here and in SVXIMAPDLG()
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- if (pViewFrm && pViewFrm->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()))
- return SVXIMAPDLG();
- else
- return NULL;
-}
-
void ScIMapDlgSet( const Graphic& rGraphic, const ImageMap* pImageMap,
const TargetList* pTargetList, void* pEditingObj )
{
diff --git a/sc/source/ui/view/imapwrap.hxx b/sc/source/ui/view/imapwrap.hxx
index 592f1c7..c3733f5 100644
--- a/sc/source/ui/view/imapwrap.hxx
+++ b/sc/source/ui/view/imapwrap.hxx
@@ -28,8 +28,6 @@ class Graphic;
class ImageMap;
class SvxIMapDlg;
-SvxIMapDlg * ScGetIMapDlg();
-
sal_uInt16 ScIMapChildWindowId();
ImageMap const & ScIMapDlgGetMap(SvxIMapDlg * pDlg);
diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx
index 6cfbc96..07dd2e1 100644
--- a/sc/source/ui/view/tabvwsh9.cxx
+++ b/sc/source/ui/view/tabvwsh9.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <svx/imapdlg.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdview.hxx>
#include <svx/gallery.hxx>
@@ -106,7 +107,7 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
if ( pThisFrame->HasChildWindow( nId ) )
{
- SvxIMapDlg* pDlg = ScGetIMapDlg();
+ SvxIMapDlg* pDlg = GetIMapDlg();
if ( pDlg )
{
SdrView* pDrView = GetSdrView();
@@ -131,7 +132,7 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
if ( pMark )
{
SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
- SvxIMapDlg* pDlg = ScGetIMapDlg();
+ SvxIMapDlg* pDlg = GetIMapDlg();
if ( ScIMapDlgGetObj(pDlg) == (void*) pSdrObj )
{
@@ -192,7 +193,7 @@ void ScTabViewShell::GetImageMapState( SfxItemSet& rSet )
{
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
if ( rMarkList.GetMarkCount() == 1 )
- if ( ScIMapDlgGetObj(ScGetIMapDlg()) ==
+ if ( ScIMapDlgGetObj(GetIMapDlg()) ==
(void*) rMarkList.GetMark(0)->GetMarkedSdrObj() )
bDisable = false;
}
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 0ac7de5..657e469 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -109,7 +109,7 @@ SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( vcl::Window* _pParent, sal_uInt16
void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
const TargetList* pTargetList, void* pEditingObj )
{
- SvxIMapDlg* pDlg = SVXIMAPDLG();
+ SvxIMapDlg* pDlg = GetIMapDlg();
if (pDlg)
pDlg->UpdateLink(rGraphic, pImageMap, pTargetList, pEditingObj);
}
@@ -773,4 +773,12 @@ IMPL_LINK_NOARG(SvxIMapDlg, MiscHdl)
return 0L;
}
+SvxIMapDlg* GetIMapDlg()
+{
+ SfxChildWindow* pWnd = NULL;
+ if (SfxViewFrame::Current() && SfxViewFrame::Current()->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()))
+ pWnd = SfxViewFrame::Current()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
+ return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : NULL;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8e375ba24da264cc4d711b535c547a2546435475
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jan 24 15:15:44 2015 +0000
coverity#1265799 Dereference null return value
Change-Id: I7f1838b55d7b526327efb0562f3ad1ab5a1778a1
diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx
index 5530488..d4bbb7a 100644
--- a/include/svx/imapdlg.hxx
+++ b/include/svx/imapdlg.hxx
@@ -155,17 +155,13 @@ public:
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
};
-
-/*************************************************************************
-|*
-|* Defines
-|*
-\************************************************************************/
-
-#define SVXIMAPDLG() ( static_cast<SvxIMapDlg*>( SfxViewFrame::Current()->GetChildWindow( \
- SvxIMapDlgChildWindow::GetChildWindowId() )-> \
- GetWindow() ) )
-
+inline SvxIMapDlg* SVXIMAPDLG()
+{
+ SfxChildWindow* pWnd = NULL;
+ if (SfxViewFrame::Current() && SfxViewFrame::Current()->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()))
+ pWnd = SfxViewFrame::Current()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
+ return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : NULL;
+}
#endif // INCLUDED_SVX_IMAPDLG_HXX
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 6866020..0ac7de5 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -109,9 +109,9 @@ SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( vcl::Window* _pParent, sal_uInt16
void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
const TargetList* pTargetList, void* pEditingObj )
{
- if ( SfxViewFrame::Current() &&
- SfxViewFrame::Current()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
- SVXIMAPDLG()->UpdateLink( rGraphic, pImageMap, pTargetList, pEditingObj );
+ SvxIMapDlg* pDlg = SVXIMAPDLG();
+ if (pDlg)
+ pDlg->UpdateLink(rGraphic, pImageMap, pTargetList, pEditingObj);
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeStatusBar(vcl::Window *pParent, VclBuilder::stringmap &)
More information about the Libreoffice-commits
mailing list