diff options
author | Uray M. János <uray.janos@gmail.com> | 2012-08-07 14:33:56 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-08-07 16:00:14 +0300 |
commit | 51bb488ac1b3e0c18947d6c68be6b577106f27d9 (patch) | |
tree | 3b139929d7319f4a32f6116850e0a2dac4a48538 /basctl/source/basicide/basides2.cxx | |
parent | 69a70bf0285e8dfdbba10694fe56bbc80f0fdae0 (diff) |
IDE: PTR_CAST, ISA to dynamic_cast
Convert the obsolete PTR_CAST and ISA macros (from tools/rtti.hxx) to
C++ dynamic_cast is basctl.
Change-Id: I45530d1d34d132904f812e238ee3b59b1a4f227b
Diffstat (limited to 'basctl/source/basicide/basides2.cxx')
-rw-r--r-- | basctl/source/basicide/basides2.cxx | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index a324ebfbe4c6..e30ec199da1e 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -52,23 +52,21 @@ Reference< view::XRenderable > BasicIDEShell::GetRenderable() sal_Bool BasicIDEShell::HasSelection( sal_Bool /* bText */ ) const { - bool bSel = false; - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { - TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView(); + TextView* pEditView = pMCurWin->GetEditView(); if ( pEditView && pEditView->HasSelection() ) - bSel = true; + return true; } - return bSel; + return false; } String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord ) { String aText; - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { - TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView(); - if ( pEditView ) + if (TextView* pEditView = pMCurWin->GetEditView()) { if ( bWholeWord && !pEditView->HasSelection() ) { @@ -87,7 +85,7 @@ String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord ) SfxPrinter* BasicIDEShell::GetPrinter( sal_Bool bCreate ) { - if ( pCurWin ) // && pCurWin->ISA( ModulWindow ) ) + if ( pCurWin ) { BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell(); DBG_ASSERT( pDocShell, "DocShell ?!" ); @@ -242,41 +240,30 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const ModulWindow* BasicIDEShell::FindBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName, bool bCreateIfNotExist, bool bFindSuspended ) { - ModulWindow* pModWin = 0; for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( ModulWindow ) ) ) - { - if ( rLibName.isEmpty() ) - { - pModWin = (ModulWindow*)pWin; - break; - } - else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rModName ) + if (!pWin->IsSuspended() || bFindSuspended) + if (rLibName.isEmpty() || (pWin->IsDocument(rDocument) && pWin->GetLibName() == rLibName && pWin->GetName() == rModName)) { - pModWin = (ModulWindow*)pWin; - break; + if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin)) + return pModWin; } - } } - if ( !pModWin && bCreateIfNotExist ) - pModWin = CreateBasWin( rDocument, rLibName, rModName ); - - return pModWin; + return bCreateIfNotExist ? CreateBasWin(rDocument, rLibName, rModName) : 0; } void BasicIDEShell::Move() { - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - ((ModulWindow*)pCurWin)->FrameWindowMoved(); + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->FrameWindowMoved(); } void BasicIDEShell::ShowCursor( bool bOn ) { - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - ((ModulWindow*)pCurWin)->ShowCursor( bOn ); + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->ShowCursor(bOn); } // Hack for #101048 @@ -285,7 +272,7 @@ sal_Int32 getBasicIDEShellCount( void ); // only if basic window above: void BasicIDEShell::ExecuteBasic( SfxRequest& rReq ) { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) + if (!dynamic_cast<ModulWindow*>(pCurWin)) return; pCurWin->ExecuteCommand( rReq ); |