summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-07-03 08:22:45 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-07-03 08:24:09 +0200
commitf36e64d8cc4a2fce8d84ef464a482445a8b8540a (patch)
treebb3934252107a275cd33cfb756e4b7042c9e55b7
parent6c4e21a234f12e1310ba06f9859e08b424acf8bf (diff)
Avoid null this pointers in member function calls
Change-Id: Iada6d8fcd261ddfb02b4dbc2f628ef0738c4ea01
-rw-r--r--cui/source/tabpages/tpbitmap.cxx6
-rw-r--r--cui/source/tabpages/tpcolor.cxx5
-rw-r--r--cui/source/tabpages/tpgradnt.cxx6
-rw-r--r--cui/source/tabpages/tphatch.cxx5
-rw-r--r--cui/source/tabpages/tplnedef.cxx2
-rw-r--r--cui/source/tabpages/tplneend.cxx5
-rw-r--r--include/svx/svdmodel.hxx12
-rw-r--r--include/svx/xtable.hxx42
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx5
-rw-r--r--svx/source/unodraw/unoctabl.cxx4
-rw-r--r--svx/source/xoutdev/xtabcolr.cxx5
11 files changed, 64 insertions, 33 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 4cab426e8d0c..953993c7a352 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -791,8 +791,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickLoadHdl_Impl)
aPathURL.removeFinalSlash();
// save table
- XBitmapListRef pBmpList = XPropertyList::CreatePropertyList(
- XBITMAP_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )->AsBitmapList();
+ XBitmapListRef pBmpList = XPropertyList::AsBitmapList(
+ XPropertyList::CreatePropertyList(
+ XBITMAP_LIST, aPathURL.GetMainURL(INetURLObject::NO_DECODE),
+ ""));
pBmpList->SetName( aURL.getName() );
if( pBmpList->Load() )
{
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index add743b89544..52ead2371577 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -155,8 +155,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl)
if ( aDlg.Execute() == ERRCODE_NONE )
{
- XColorListRef pList = XPropertyList::CreatePropertyListFromURL(
- meType, aDlg.GetPath() )->AsColorList();
+ XColorListRef pList = XPropertyList::AsColorList(
+ XPropertyList::CreatePropertyListFromURL(
+ meType, aDlg.GetPath()));
if( pList->Load() )
{
// check whether the table may be deleted:
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index cbdefb300a08..96c48ffc747c 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -644,8 +644,10 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickLoadHdl_Impl)
aPathURL.removeFinalSlash();
// save list
- XGradientListRef pGrdList = XPropertyList::CreatePropertyList(
- XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )->AsGradientList();
+ XGradientListRef pGrdList = XPropertyList::AsGradientList(
+ XPropertyList::CreatePropertyList(
+ XGRADIENT_LIST,
+ aPathURL.GetMainURL(INetURLObject::NO_DECODE), ""));
pGrdList->SetName( aURL.getName() );
if ( pGrdList->Load() )
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index ae155b0f2ec4..0cdff356e37e 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -685,8 +685,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickLoadHdl_Impl)
aPathURL.removeSegment();
aPathURL.removeFinalSlash();
- XHatchListRef pHatchList = XPropertyList::CreatePropertyList(
- XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )->AsHatchList();
+ XHatchListRef pHatchList = XPropertyList::AsHatchList(
+ XPropertyList::CreatePropertyList(
+ XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" ));
pHatchList->SetName( aURL.getName() );
if( pHatchList->Load() )
{
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 7dcca4b0e3a2..b2ddb14b8be0 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -749,7 +749,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl)
aPathURL.removeSegment();
aPathURL.removeFinalSlash();
- XDashListRef pDshLst = XPropertyList::CreatePropertyList( XDASH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )->AsDashList();
+ XDashListRef pDshLst = XPropertyList::AsDashList(XPropertyList::CreatePropertyList( XDASH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" ));
pDshLst->SetName( aURL.getName() );
if( pDshLst->Load() )
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 6cbcce81704f..c0264a79afde 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -570,7 +570,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl)
aPathURL.removeSegment();
aPathURL.removeFinalSlash();
- XLineEndListRef pLeList = XPropertyList::CreatePropertyList(XLINE_END_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )->AsLineEndList();
+ XLineEndListRef pLeList = XPropertyList::AsLineEndList(
+ XPropertyList::CreatePropertyList(
+ XLINE_END_LIST,
+ aPathURL.GetMainURL(INetURLObject::NO_DECODE), ""));
pLeList->SetName( aURL.getName() );
if( pLeList->Load() )
{
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 350ad963deba..5be7bcb497a1 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -597,12 +597,12 @@ public:
void SetPropertyList( XPropertyListRef p ) { maProperties[ p->Type() ] = p; }
// friendlier helpers
- XDashListRef GetDashList() const { return GetPropertyList( XDASH_LIST )->AsDashList(); }
- XHatchListRef GetHatchList() const { return GetPropertyList( XHATCH_LIST )->AsHatchList(); }
- XColorListRef GetColorList() const { return GetPropertyList( XCOLOR_LIST )->AsColorList(); }
- XBitmapListRef GetBitmapList() const { return GetPropertyList( XBITMAP_LIST )->AsBitmapList(); }
- XLineEndListRef GetLineEndList() const { return GetPropertyList( XLINE_END_LIST )->AsLineEndList(); }
- XGradientListRef GetGradientList() const { return GetPropertyList( XGRADIENT_LIST )->AsGradientList(); }
+ XDashListRef GetDashList() const { return XPropertyList::AsDashList(GetPropertyList( XDASH_LIST )); }
+ XHatchListRef GetHatchList() const { return XPropertyList::AsHatchList(GetPropertyList( XHATCH_LIST )); }
+ XColorListRef GetColorList() const { return XPropertyList::AsColorList(GetPropertyList( XCOLOR_LIST )); }
+ XBitmapListRef GetBitmapList() const { return XPropertyList::AsBitmapList(GetPropertyList( XBITMAP_LIST )); }
+ XLineEndListRef GetLineEndList() const { return XPropertyList::AsLineEndList(GetPropertyList( XLINE_END_LIST )); }
+ XGradientListRef GetGradientList() const { return XPropertyList::AsGradientList(GetPropertyList( XGRADIENT_LIST )); }
// The DrawingEngine only references the StyleSheetPool, whoever
// made it needs to delete it.
diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx
index d86b5f49e4ab..a6585969c928 100644
--- a/include/svx/xtable.hxx
+++ b/include/svx/xtable.hxx
@@ -266,12 +266,18 @@ public:
const OUString & rUrl);
// helper accessors
- inline XDashListRef AsDashList();
- inline XHatchListRef AsHatchList();
- inline XColorListRef AsColorList();
- inline XBitmapListRef AsBitmapList();
- inline XLineEndListRef AsLineEndList();
- inline XGradientListRef AsGradientList();
+ static inline XDashListRef AsDashList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XHatchListRef AsHatchList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XColorListRef AsColorList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XBitmapListRef AsBitmapList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XLineEndListRef AsLineEndList(
+ rtl::Reference<XPropertyList> const & plist);
+ static inline XGradientListRef AsGradientList(
+ rtl::Reference<XPropertyList> const & plist);
};
@@ -429,12 +435,24 @@ public:
// FIXME: could add type checking too ...
-inline XDashListRef XPropertyList::AsDashList() { return XDashListRef( static_cast<XDashList *> (this) ); }
-inline XHatchListRef XPropertyList::AsHatchList() { return XHatchListRef( static_cast<XHatchList *> (this) ); }
-inline XColorListRef XPropertyList::AsColorList() { return XColorListRef( static_cast<XColorList *> (this) ); }
-inline XBitmapListRef XPropertyList::AsBitmapList() { return XBitmapListRef( static_cast<XBitmapList *> (this) ); }
-inline XLineEndListRef XPropertyList::AsLineEndList() { return XLineEndListRef( static_cast<XLineEndList *> (this) ); }
-inline XGradientListRef XPropertyList::AsGradientList() { return XGradientListRef( static_cast<XGradientList *> (this) ); }
+inline XDashListRef XPropertyList::AsDashList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XDashListRef( static_cast<XDashList *> (plist.get()) ); }
+inline XHatchListRef XPropertyList::AsHatchList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XHatchListRef( static_cast<XHatchList *> (plist.get()) ); }
+inline XColorListRef XPropertyList::AsColorList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XColorListRef( static_cast<XColorList *> (plist.get()) ); }
+inline XBitmapListRef XPropertyList::AsBitmapList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XBitmapListRef( static_cast<XBitmapList *> (plist.get()) ); }
+inline XLineEndListRef XPropertyList::AsLineEndList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XLineEndListRef( static_cast<XLineEndList *> (plist.get()) ); }
+inline XGradientListRef XPropertyList::AsGradientList(
+ rtl::Reference<XPropertyList> const & plist)
+{ return XGradientListRef( static_cast<XGradientList *> (plist.get()) ); }
#endif // INCLUDED_SVX_XTABLE_HXX
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 097d47506467..fb0b930d5cfd 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -410,8 +410,9 @@ void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
boost::scoped_ptr<XBitmapEntry> pEntry(new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr));
XBitmapListRef xBitmapList =
- XPropertyList::CreatePropertyList(XBITMAP_LIST,
- OUString("TmpList"), ""/*TODO?*/)->AsBitmapList();
+ XPropertyList::AsBitmapList(
+ XPropertyList::CreatePropertyList(
+ XBITMAP_LIST, "TmpList", ""/*TODO?*/));
xBitmapList->Insert( pEntry.get() );
xBitmapList->SetDirty( false );
mpFillAttrLB->Fill( xBitmapList );
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index 759435cac5dd..5a4136d0dcd5 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -64,7 +64,9 @@ public:
SvxUnoColorTable::SvxUnoColorTable()
{
- pList = XPropertyList::CreatePropertyList( XCOLOR_LIST, SvtPathOptions().GetPalettePath(), "" )->AsColorList();
+ pList = XPropertyList::AsColorList(
+ XPropertyList::CreatePropertyList(
+ XCOLOR_LIST, SvtPathOptions().GetPalettePath(), ""));
}
sal_Bool SAL_CALL SvxUnoColorTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException, std::exception)
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index d70a4fbcdb5e..85c3b4ff1635 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -29,8 +29,9 @@ using namespace com::sun::star;
XColorListRef XColorList::CreateStdColorList()
{
- return XPropertyList::CreatePropertyList(
- XCOLOR_LIST, SvtPathOptions().GetPalettePath(), "" )->AsColorList();
+ return XPropertyList::AsColorList(
+ XPropertyList::CreatePropertyList(
+ XCOLOR_LIST, SvtPathOptions().GetPalettePath(), ""));
}
XColorListRef XColorList::GetStdColorList()