summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-18 15:10:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-23 17:27:47 +0200
commit23e1fc277d5651babce17bb74408ef6505f101d2 (patch)
treeedf64a973766400f870095f4ecd25784bfea6ba5 /sd
parent7f895dfbf5fb084d747e52db678d75e3273cd825 (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 'sd')
-rw-r--r--sd/source/filter/html/htmlex.cxx2
-rw-r--r--sd/source/ui/app/tbxww.cxx2
-rw-r--r--sd/source/ui/docshell/docshell.cxx12
3 files changed, 8 insertions, 8 deletions
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index ca11bcdbe24b..389ca500571d 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1467,7 +1467,7 @@ OUString HtmlExport::TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState
SvxFieldItem* pItem = (SvxFieldItem*)pSet->GetItem( EE_FEATURE_FIELD );
if(pItem)
{
- SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
+ const SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
if(pURL)
{
aLink = pURL->GetURL();
diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx
index e48084fc07fc..40ee52f1ddd9 100644
--- a/sd/source/ui/app/tbxww.cxx
+++ b/sd/source/ui/app/tbxww.cxx
@@ -134,7 +134,7 @@ void SdTbxControl::StateChanged( sal_uInt16 nSId,
if( eState == SfxItemState::DEFAULT )
{
- TbxImageItem* pItem = PTR_CAST( TbxImageItem, pState );
+ const TbxImageItem* pItem = PTR_CAST( TbxImageItem, pState );
// StarDesktop can also receive another item,
// but it is not allowed to evaluate it
if( pItem )
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index a184ccf93d10..0b9e31c4cb69 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -285,8 +285,6 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
void DrawDocShell::InPlaceActivate( bool bActive )
{
- ViewShell* pViewSh = NULL;
- SfxViewShell* pSfxViewSh = NULL;
SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
std::vector<FrameView*> &rViews = mpDoc->GetFrameViewList();
@@ -301,8 +299,9 @@ void DrawDocShell::InPlaceActivate( bool bActive )
while (pSfxViewFrame)
{
// determine the number of FrameViews
- pSfxViewSh = pSfxViewFrame->GetViewShell();
- pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+ SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell();
+ // FIXME this used to be a PTR_CAST, but when I updated the macro, I discovered that SfxViewShell is not statically castable to sd::ViewShell
+ ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0;
if ( pViewSh && pViewSh->GetFrameView() )
{
@@ -321,8 +320,9 @@ void DrawDocShell::InPlaceActivate( bool bActive )
for( sal_uInt32 i = 0; pSfxViewFrame && (i < rViews.size()); i++ )
{
// determine the number of FrameViews
- pSfxViewSh = pSfxViewFrame->GetViewShell();
- pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+ SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell();
+ // FIXME this used to be a PTR_CAST, but when I updated the macro, I discovered that SfxViewShell is not statically castable to sd::ViewShell
+ ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0;
if ( pViewSh )
{