diff options
author | Noel Grandin <noel@peralex.com> | 2014-09-18 15:10:54 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-23 17:27:47 +0200 |
commit | 23e1fc277d5651babce17bb74408ef6505f101d2 (patch) | |
tree | edf64a973766400f870095f4ecd25784bfea6ba5 /sfx2 | |
parent | 7f895dfbf5fb084d747e52db678d75e3273cd825 (diff) |
loplugin: cstylecast, update PTR_CAST macro to use static_cast
I introduce a template method into the PTR_CAST machinery
to maintain constness.
There is now a FIXME in sd/../docshell.cxx because I needed
to use a dynamic_cast there to work around the games it appears
to be playing with OLE in-place activation.
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>,
dropping the GCC-extension, unnecessary use of typeof from tools/rtti.hxx
Change-Id: Iba5ace1aa27e02b34fcc91af1e658c43371afd03
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objitem.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 22908faf7a7f..e675f38ce478 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -327,7 +327,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri const SfxPoolItem *pRet = GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, &aName, &aHidden, &aReferer, &aFlags, 0L ); const SfxObjectItem *pObj = PTR_CAST( SfxObjectItem, pRet ); if ( pObj ) - xDoc = PTR_CAST( SfxObjectShell, pObj->GetShell() ); + xDoc = const_cast<SfxObjectShell*>(PTR_CAST( SfxObjectShell, pObj->GetShell() )); else { const SfxViewFrameItem *pView = PTR_CAST( SfxViewFrameItem, pRet ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 7798695bbbfc..f5624bc3e643 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -419,7 +419,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( pObjSh->IsModified() ) { pObjSh->ExecuteSlot( aReq ); - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() ); + const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() ); if ( !pItem || !pItem->GetValue() ) bOK = false; } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 7aac28c40446..45db4a656934 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1718,7 +1718,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl( if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) ) { - SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem); + const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem); OSL_ENSURE(pFilterItem, "SfxUINT16Item expected"); sal_uInt16 nFilterFlags = pFilterItem->GetValue() & ~SFXSTYLEBIT_USERDEF; if(!nFilterFlags) // User Template? diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index 15798ae5b362..b5c8fa022633 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -109,7 +109,7 @@ SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh ) bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const { - SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem); + const SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem); return pOther->_pSh == _pSh; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 4b99eee87211..f96ae3de4fce 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -523,7 +523,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) { // TODO/LATER: currently the application guards against the reentrance problem const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); + const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); bResult = ( pResult && pResult->GetValue() ); if ( bResult ) aOrigURL = GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); @@ -557,7 +557,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) // TODO/LATER: currently the application guards against the reentrance problem SetModified( true ); // the modified flag has to be set to let the document be stored with the shared flag const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); + const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); bResult = ( pResult && pResult->GetValue() ); } } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 4dec0d6470d7..521972330501 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -331,7 +331,7 @@ namespace // On the other side some special slots return a boolean state, // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); + const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); if ( pItem ) bSuccess = pItem->GetValue(); |