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 | |
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')
-rw-r--r-- | basctl/source/accessibility/accessibledialogwindow.cxx | 44 | ||||
-rw-r--r-- | basctl/source/basicide/basicbox.cxx | 22 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 44 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 164 | ||||
-rw-r--r-- | basctl/source/basicide/basides2.cxx | 47 | ||||
-rw-r--r-- | basctl/source/basicide/basides3.cxx | 36 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 24 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 11 | ||||
-rw-r--r-- | basctl/source/basicide/bastype3.cxx | 31 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 20 | ||||
-rw-r--r-- | basctl/source/basicide/localizationmgr.cxx | 31 | ||||
-rw-r--r-- | basctl/source/basicide/sbxitem.cxx | 16 | ||||
-rw-r--r-- | basctl/source/basicide/tbxctl.cxx | 6 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 20 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedfunc.cxx | 2 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 73 | ||||
-rw-r--r-- | basctl/source/dlged/propbrw.cxx | 6 | ||||
-rw-r--r-- | basctl/source/inc/dlgedobj.hxx | 3 |
18 files changed, 240 insertions, 360 deletions
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 7c40a3ffff5f..2982cda8918a 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -121,9 +121,7 @@ AccessibleDialogWindow::AccessibleDialogWindow( DialogWindow* pDialogWindow ) for ( sal_uLong i = 0; i < nCount; ++i ) { - SdrObject* pObj = pSdrPage->GetObj( i ); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i))) { ChildDescriptor aDesc( pDlgEdObj ); if ( IsChildVisible( aDesc ) ) @@ -341,16 +339,11 @@ void AccessibleDialogWindow::UpdateChildren() { if ( m_pDialogWindow ) { - SdrPage* pSdrPage = m_pDialogWindow->GetPage(); - if ( pSdrPage ) + if (SdrPage* pSdrPage = m_pDialogWindow->GetPage()) { for ( sal_uLong i = 0, nCount = pSdrPage->GetObjCount(); i < nCount; ++i ) - { - SdrObject* pObj = pSdrPage->GetObj( i ); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i))) UpdateChild( ChildDescriptor( pDlgEdObj ) ); - } } } } @@ -368,17 +361,15 @@ void AccessibleDialogWindow::SortChildren() IMPL_LINK( AccessibleDialogWindow, WindowEventListener, VclSimpleEvent*, pEvent ) { DBG_CHKTHIS( AccessibleDialogWindow, 0 ); - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "AccessibleDialogWindow::WindowEventListener: unknown window event!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) + if (VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent)) { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!" ); - if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) - { - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } + DBG_ASSERT(pWinEvent->GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!"); + if (!pWinEvent->GetWindow()->IsAccessibilityEventsSuppressed() || pEvent->GetId() == VCLEVENT_OBJECT_DYING) + ProcessWindowEvent(*pWinEvent); } - + else + DBG_ASSERT(false, "AccessibleDialogWindow::WindowEventListener: unknown window event!"); return 0; } @@ -522,16 +513,13 @@ awt::Rectangle AccessibleDialogWindow::implGetBounds() throw (RuntimeException) void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - if ( rHint.ISA( SdrHint ) ) + if (SdrHint* pSdrHint = dynamic_cast<SdrHint*>(&rHint)) { - SdrHint* pSdrHint = (SdrHint*)&rHint; switch ( pSdrHint->GetKind() ) { case HINT_OBJINSERTED: { - SdrObject* pObj = (SdrObject*)pSdrHint->GetObject(); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrHint->GetObject())) { ChildDescriptor aDesc( pDlgEdObj ); if ( IsChildVisible( aDesc ) ) @@ -541,18 +529,15 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; case HINT_OBJREMOVED: { - SdrObject* pObj = (SdrObject*)pSdrHint->GetObject(); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrHint->GetObject())) RemoveChild( ChildDescriptor( pDlgEdObj ) ); } break; default: ; } } - else if ( rHint.ISA( DlgEdHint ) ) + else if (DlgEdHint* pDlgEdHint = dynamic_cast<DlgEdHint*>(&rHint)) { - DlgEdHint* pDlgEdHint = (DlgEdHint*)&rHint; switch ( pDlgEdHint->GetKind() ) { case DLGED_HINT_WINDOWSCROLLED: @@ -563,8 +548,7 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; case DLGED_HINT_LAYERCHANGED: { - DlgEdObj* pDlgEdObj = pDlgEdHint->GetObject(); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = pDlgEdHint->GetObject()) UpdateChild( ChildDescriptor( pDlgEdObj ) ); } break; diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index 99ffa2392d73..34158fcfadd7 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -69,11 +69,7 @@ void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPool else { pBox->Enable(); - - if ( pState->ISA(SfxStringItem) ) - pBox->Update( (const SfxStringItem*)pState ); - else - pBox->Update( NULL ); + pBox->Update(dynamic_cast<SfxStringItem const*>(pState)); } } @@ -357,23 +353,17 @@ LanguageBoxControl::~LanguageBoxControl() { } -void LanguageBoxControl::StateChanged( sal_uInt16 _nID, SfxItemState _eState, const SfxPoolItem* _pItem ) +void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, const SfxPoolItem* pItem ) { - (void)_nID; - - BasicLanguageBox* pBox = (BasicLanguageBox*)( GetToolBox().GetItemWindow( GetId() ) ); - - if ( pBox ) + (void)nID; + if (BasicLanguageBox* pBox = static_cast<BasicLanguageBox*>(GetToolBox().GetItemWindow(GetId()))) { - if ( _eState != SFX_ITEM_AVAILABLE ) + if (eState != SFX_ITEM_AVAILABLE) pBox->Disable(); else { pBox->Enable(); - if ( _pItem->ISA(SfxStringItem) ) - pBox->Update( (const SfxStringItem*)_pItem ); - else - pBox->Update( NULL ); + pBox->Update(dynamic_cast<SfxStringItem const*>(pItem)); } } } diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 2854eb1fe7e6..0f11e8433343 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -49,8 +49,19 @@ using namespace ::com::sun::star::uno; namespace { + long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow long nHeaderBarHeight; + +// Returns pBase converted to SbxVariable if valid and is not an SbxMethod. +SbxVariable const* IsSbxVariable (SbxBase const* pBase) +{ + if (SbxVariable const* pVar = dynamic_cast<SbxVariable const*>(pBase)) + if (!dynamic_cast<SbxMethod const*>(pVar)) + return pVar; + return 0; +} + } // namespace #define SCROLL_LINE 12 @@ -297,9 +308,8 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt ) if ( strchr( cSuffixes, aWord.GetChar( nLastChar ) ) ) aWord.Erase( nLastChar, 1 ); SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) + if (SbxVariable const* pVar = IsSbxVariable(pSBX)) { - SbxVariable* pVar = (SbxVariable*)pSBX; SbxDataType eType = pVar->GetType(); if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT ) // might cause a crash e. g. at the selections-object @@ -673,9 +683,9 @@ void EditorWindow::DataChanged(DataChangedEvent const & rDCEvt) void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if ( rHint.ISA( TextHint ) ) + if (TextHint const* pTextHint = dynamic_cast<TextHint const*>(&rHint)) { - const TextHint& rTextHint = (const TextHint&)rHint; + TextHint const& rTextHint = *pTextHint; if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) { if ( pModulWindow->GetHScrollBar() ) @@ -1891,10 +1901,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArra if( pObj ) { pSBX = pObj->Find( aVName, SbxCLASS_DONTCARE ); - - SbxVariable* pVar; - if ( pSBX && (pVar = PTR_CAST( SbxVariable, pSBX )) != NULL - && !pSBX->ISA( SbxMethod ) ) + if (SbxVariable const* pVar = IsSbxVariable(pSBX)) { // Force getting value SbxValues aRes; @@ -1926,8 +1933,8 @@ sal_Bool WatchTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) { // No out of scope entries bool bArrayElement; - SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement ); - if ( ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) || bArrayElement ) + SbxBase const* pSbx = ImplGetSBXForEntry( pEntry, bArrayElement ); + if (IsSbxVariable(pSbx) || bArrayElement) { // Accept no objects and only end nodes of arrays for editing if( !pItem->mpObject && (pItem->mpArray == NULL || pItem->nDimLevel == pItem->nDimCount) ) @@ -1963,9 +1970,8 @@ bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& bool bArrayElement; SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement ); - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) + if (SbxVariable const* pVar = IsSbxVariable(pSBX)) { - SbxVariable* pVar = (SbxVariable*)pSBX; SbxDataType eType = pVar->GetType(); if ( (sal_uInt8)eType != (sal_uInt8)SbxOBJECT && ( eType & SbxARRAY ) == 0 ) @@ -2082,18 +2088,15 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } bool bCollapse = false; - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) + if (SbxVariable const* pVar = IsSbxVariable(pSBX)) { - SbxVariable* pVar = (SbxVariable*)pSBX; // extra treatment of arrays SbxDataType eType = pVar->GetType(); if ( eType & SbxARRAY ) { // consider multidimensinal arrays! - SbxBase* pBase = pVar->GetObject(); - if ( pBase && pBase->ISA( SbxDimArray ) ) + if (SbxDimArray* pNewArray = dynamic_cast<SbxDimArray*>(pVar->GetObject())) { - SbxDimArray* pNewArray = (SbxDimArray*)pBase; SbxDimArray* pOldArray = pItem->mpArray; bool bArrayChanged = false; @@ -2154,12 +2157,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } else if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT ) { - SbxObject* pObj = NULL; - SbxBase* pBase = pVar->GetObject(); - if( pBase && pBase->ISA( SbxObject ) ) - pObj = (SbxObject*)pBase; - - if( pObj ) + if (SbxObject* pObj = dynamic_cast<SbxObject*>(pVar->GetObject())) { // Check if member list has changed bool bObjChanged = false; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index c43156cb3acb..06ed7528a6d3 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -80,14 +80,10 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) case SID_SHOWLINES: { SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false); - bool bValue = false; - if ( pItem ) - bValue = pItem->GetValue(); + bool const bValue = pItem && pItem->GetValue(); lcl_GetSourceLinesEnabledValue() = bValue; - if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) - { - dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay( bValue ); - } + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->SetLineNumberDisplay(bValue); } break; @@ -103,7 +99,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) ::rtl::OUString aLibName = pCurWin->GetLibName(); ::rtl::OUString aName = pCurWin->GetName(); - if ( pCurWin->ISA( ModulWindow ) ) + if (dynamic_cast<ModulWindow*>(pCurWin)) { if ( QueryDelModule( aName, pCurWin ) ) { @@ -133,7 +129,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) break; case FID_SEARCH_NOW: { - if ( pCurWin->ISA( ModulWindow ) ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); const SfxItemSet* pArgs = rReq.GetArgs(); @@ -141,35 +137,35 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) sal_uInt16 nWhich = pArgs->GetWhichByPos( 0 ); DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" ); const SfxPoolItem& rItem = pArgs->Get( nWhich ); - DBG_ASSERT( rItem.ISA( SvxSearchItem ), "Kein Searchitem!" ); IDEWindowTable::const_iterator it; - if ( rItem.ISA( SvxSearchItem ) ) + if (SvxSearchItem const* pSearchItem = dynamic_cast<SvxSearchItem const*>(&rItem)) { // memorize item because of the adjustments... - BasicIDEGlobals::GetExtraData()->SetSearchItem( (const SvxSearchItem&)rItem ); + BasicIDEGlobals::GetExtraData()->SetSearchItem(*pSearchItem); sal_Int32 nFound = 0; bool bCanceled = false; - if ( ((const SvxSearchItem&)rItem).GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) + if (pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) { sal_uInt16 nActModWindows = 0; for( it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) + if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin)) nActModWindows++; } - if ( ( nActModWindows <= 1 ) || ( !((const SvxSearchItem&)rItem).GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) ) + if ( ( nActModWindows <= 1 ) || ( !pSearchItem->GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) ) { for( it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - nFound = nFound + ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); + if (!pWin->IsSuspended()) + if (pModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin)) + nFound += pMWin->StartSearchAndReplace(*pSearchItem); } } else - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); + nFound = pMCurWin->StartSearchAndReplace(*pSearchItem); ::rtl::OUString aReplStr(IDE_RESSTR(RID_STR_SEARCHREPLACES)); aReplStr = aReplStr.replaceAll("XX", rtl::OUString::valueOf(nFound)); @@ -177,8 +173,8 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) } else { - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); - if ( !nFound && !((const SvxSearchItem&)rItem).GetSelection() ) + nFound = pMCurWin->StartSearchAndReplace(*pSearchItem); + if ( !nFound && !pSearchItem->GetSelection() ) { // search other modules... bool bChangeCurWindow = false; @@ -211,20 +207,21 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) bCanceled = true; } - if ( pWin && !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - { - if ( pWin != pCurWin ) - { - if ( pCurWin ) - pWin->SetSizePixel( pCurWin->GetSizePixel() ); - nFound = ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, true ); - } - if ( nFound ) + if (ModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin)) + if (!pWin->IsSuspended()) { - bChangeCurWindow = true; - break; + if ( pWin != pCurWin ) + { + if ( pCurWin ) + pWin->SetSizePixel( pCurWin->GetSizePixel() ); + nFound = pMWin->StartSearchAndReplace(*pSearchItem, true); + } + if ( nFound ) + { + bChangeCurWindow = true; + break; + } } - } if ( pWin && ( pWin != pCurWin ) ) { if ( it != aIDEWindowTable.end() ) @@ -238,7 +235,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) pWin = 0; } if ( !nFound && bSearchedFromStart ) - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, true ); + nFound = pMCurWin->StartSearchAndReplace(*pSearchItem, true); if ( bChangeCurWindow ) SetCurWindow( pWin, true ); } @@ -248,12 +245,14 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) rReq.Done(); } + else + DBG_ASSERT(false, "no searchitem!"); } } break; case FID_SEARCH_OFF: { - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) + if (dynamic_cast<ModulWindow*>(pCurWin)) pCurWin->GrabFocus(); } break; @@ -268,7 +267,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) break; case SID_GOTOLINE: { - if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { std::auto_ptr< GotoLineDialog > xGotoDlg( new GotoLineDialog( pCurWin ) ); if ( xGotoDlg->Execute() ) @@ -298,8 +297,8 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICSTOP: { // maybe do not simply stop if on breakpoint! - if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) - ((ModulWindow*)pCurWin)->BasicStop(); + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->BasicStop(); BasicIDE::StopBasic(); } break; @@ -461,13 +460,12 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) if ( aNewName != aOldName ) { bool bRenameOk = false; - if ( pWin->IsA( TYPE( ModulWindow ) ) ) + if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin)) { - ModulWindow* pModWin = (ModulWindow*)pWin; - ::rtl::OUString aLibName = ( pModWin->GetLibName() ); + rtl::OUString aLibName = pModWin->GetLibName(); ScriptDocument aDocument( pWin->GetDocument() ); - if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) + if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) { bRenameOk = true; // Because we listen for container events for script @@ -477,9 +475,8 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) } } - else if ( pWin->IsA( TYPE( DialogWindow ) ) ) + else if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin)) { - DialogWindow* pDlgWin = (DialogWindow*)pWin; bRenameOk = pDlgWin->RenameDialog( aNewName ); } if ( bRenameOk ) @@ -525,7 +522,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) + if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin)) { if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES ) pWin->StoreData(); @@ -728,9 +725,8 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) if ( pTabBar ) pTabBar->MakeVisible( pTabBar->GetCurPageId() ); - if ( pWin->ISA( ModulWindow ) ) + if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin)) { - ModulWindow* pModWin = (ModulWindow*)pWin; SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, false ); if ( pLineItem ) { @@ -817,7 +813,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) // if this is not a module window hide the // setting, doesn't make sense for example if the // dialog editor is open - if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) ) + if(pCurWin && !dynamic_cast<ModulWindow*>(pCurWin)) { rSet.DisableItem( nWh ); rSet.Put(SfxVisibilityItem(nWh, false)); @@ -881,7 +877,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) { // FIXME: hide Object Catalog icon from the toolbar, // when window type is not macro editor. - if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) ) + if(pCurWin && !dynamic_cast<ModulWindow*>(pCurWin)) { rSet.DisableItem( nWh ); rSet.Put(SfxVisibilityItem(nWh, false)); @@ -910,7 +906,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) case SID_BASICSAVEAS: case SID_BASICIDE_MATCHGROUP: { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) + if (!dynamic_cast<ModulWindow*>(pCurWin)) rSet.DisableItem( nWh ); else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) ) rSet.DisableItem( nWh ); @@ -923,22 +919,25 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) case SID_BASICIDE_TOGGLEBRKPNT: case SID_BASICIDE_MANAGEBRKPNTS: { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) - rSet.DisableItem( nWh ); - else if ( StarBASIC::IsRunning() && !((ModulWindow*)pCurWin)->GetBasicStatus().bIsInReschedule ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + { + if (StarBASIC::IsRunning() && !pMCurWin->GetBasicStatus().bIsInReschedule) + rSet.DisableItem(nWh); + } + else rSet.DisableItem( nWh ); } break; case SID_BASICCOMPILE: { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) || StarBASIC::IsRunning() ) + if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin)) rSet.DisableItem( nWh ); } break; case SID_BASICSTOP: { // stop is always possible when some Basic is running... - if ( !StarBASIC::IsRunning() ) + if (!StarBASIC::IsRunning()) rSet.DisableItem( nWh ); } break; @@ -952,7 +951,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) case SID_INSERT_FORM_HSCROLL: case SID_INSERT_FORM_SPIN: { - if( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) ) + if (!dynamic_cast<DialogWindow*>(pCurWin)) rSet.DisableItem( nWh ); } break; @@ -1092,7 +1091,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) // if this is not a module window hide the // setting, doesn't make sense for example if the // dialog editor is open - if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) ) + if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin)) { rSet.DisableItem( nWh ); rSet.Put(SfxVisibilityItem(nWh, false)); @@ -1112,7 +1111,7 @@ sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature ) if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER ) { // fade out (in) property browser in module (dialog) windows - if ( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) && !pCurWin->IsReadOnly() ) + if (dynamic_cast<DialogWindow*>(pCurWin) && !pCurWin->IsReadOnly()) bResult = true; } @@ -1140,9 +1139,9 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo pPrevCurWin->Hide(); pPrevCurWin->Deactivating(); // pPrevCurWin->GetLayoutWindow()->Hide(); - if( pPrevCurWin->IsA( TYPE( DialogWindow ) ) ) + if (DialogWindow* pDialogWin = dynamic_cast<DialogWindow*>(pPrevCurWin)) { - ((DialogWindow*)pPrevCurWin)->DisableBrowser(); + pDialogWin->DisableBrowser(); } else { @@ -1152,11 +1151,11 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo if ( pCurWin ) { AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() ); - if( pCurWin->IsA( TYPE( ModulWindow ) ) ) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { - dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay(SourceLinesDisplayed()); + pMCurWin->SetLineNumberDisplay(SourceLinesDisplayed()); GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); - pModulLayout->SetModulWindow( (ModulWindow*)pCurWin ); + pModulLayout->SetModulWindow(pMCurWin); pModulLayout->Show(); } else @@ -1170,7 +1169,8 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo BasicIDEData* pData = BasicIDEGlobals::GetExtraData(); if ( pData ) { - sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow ) ) ? BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG; + sal_uInt16 nCurrentType = dynamic_cast<ModulWindow*>(pCurWin) ? + BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG; LibInfoItem* pLibInfoItem = new LibInfoItem( pCurWin->GetDocument(), pCurWin->GetLibName(), pCurWin->GetName(), nCurrentType ); pData->GetLibInfos().InsertInfo( pLibInfoItem ); } @@ -1190,8 +1190,8 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo if ( pFocusWindow ) // Focus in BasicIDE pNewWin->GrabFocus(); } - if( pCurWin->IsA( TYPE( DialogWindow ) ) ) - ((DialogWindow*)pCurWin)->UpdateBrowser(); + if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) + pDCurWin->UpdateBrowser(); } if ( bUpdateTabBar ) { @@ -1251,7 +1251,7 @@ void BasicIDEShell::ManageToolbars() if ( xLayoutManager.is() ) { xLayoutManager->lock(); - if( pCurWin->IsA( TYPE( DialogWindow ) ) ) + if (dynamic_cast<DialogWindow*>(pCurWin)) { xLayoutManager->destroyElement( aMacroBarResName ); @@ -1290,8 +1290,8 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const return pWin; } else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName && - ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) || - ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) ) + ( ( dynamic_cast<ModulWindow*>(pWin) && nType == BASICIDE_TYPE_MODULE ) || + ( dynamic_cast<DialogWindow*>(pWin) && nType == BASICIDE_TYPE_DIALOG ) ) ) { return pWin; } @@ -1344,18 +1344,15 @@ ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) SetCurLib( ScriptDocument::getApplicationScriptDocument(), ::rtl::OUString(), false ); SbModule* pActiveModule = StarBASIC::GetActiveModule(); - SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule); - if( pClassModuleObject != NULL ) - pActiveModule = pClassModuleObject->getClassModule(); + if (SbClassModuleObject* pCMO = dynamic_cast<SbClassModuleObject*>(pActiveModule)) + pActiveModule = pCMO->getClassModule(); DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" ); if ( pActiveModule ) { ModulWindow* pWin = 0; SbxObject* pParent = pActiveModule->GetParent(); - DBG_ASSERT( pParent && pParent->ISA( StarBASIC ), "Kein BASIC!" ); - StarBASIC* pLib = static_cast< StarBASIC* >( pParent ); - if ( pLib ) + if (StarBASIC* pLib = dynamic_cast<StarBASIC*>(pParent)) { BasicManager* pBasMgr = BasicIDE::FindBasicManager( pLib ); if ( pBasMgr ) @@ -1368,6 +1365,8 @@ ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) SetCurWindow( pWin, true ); } } + else + DBG_ASSERT(false, "Kein BASIC!"); BasicManager* pBasicMgr = BasicIDE::FindBasicManager( pBasic ); if ( pBasicMgr ) StartListening( *pBasicMgr, true /* log on only once */ ); @@ -1407,14 +1406,8 @@ void BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) ); } - Window* pEdtWin = pCurWin ? pCurWin->GetLayoutWindow() : pModulLayout; - if ( pEdtWin ) - { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) - pEdtWin->SetPosSizePixel( rPos, aSz ); // without ScrollBar - else - pEdtWin->SetPosSizePixel( rPos, aOutSz ); - } + if (Window* pEdtWin = pCurWin ? pCurWin->GetLayoutWindow() : pModulLayout) + pEdtWin->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin) ? aSz : aOutSz); } Reference< XModel > BasicIDEShell::GetCurrentDocument() const @@ -1431,8 +1424,8 @@ void BasicIDEShell::Activate( sal_Bool bMDI ) if ( bMDI ) { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) - ((DialogWindow*)pCurWin)->UpdateBrowser(); + if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow>(pCurWin)) + pDCurWin->UpdateBrowser(); } } @@ -1442,9 +1435,8 @@ void BasicIDEShell::Deactivate( sal_Bool bMDI ) // deactivate due to a MessageBox bMDI is false if ( bMDI ) { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) + if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin)) { - DialogWindow* pXDlgWin = (DialogWindow*)pCurWin; pXDlgWin->DisableBrowser(); if( pXDlgWin->IsModified() ) BasicIDE::MarkDocumentModified( pXDlgWin->GetDocument() ); 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 ); diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index c0529f1bc412..17bbddbab67c 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -117,28 +117,15 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons DialogWindow* BasicIDEShell::FindDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName, bool bCreateIfNotExist, bool bFindSuspended ) { - DialogWindow* pDlgWin = 0; for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( DialogWindow ) ) ) - { - if ( rLibName.isEmpty() ) - { - pDlgWin = (DialogWindow*)pWin; - break; - } - else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rDlgName ) - { - pDlgWin = (DialogWindow*)pWin; - break; - } - } + if (!pWin->IsSuspended() || bFindSuspended) + if (rLibName.isEmpty() || (pWin->IsDocument(rDocument) && pWin->GetLibName() == rLibName && pWin->GetName() == rDlgName)) + if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin)) + return pDlgWin; } - if ( !pDlgWin && bCreateIfNotExist ) - pDlgWin = CreateDlgWin( rDocument, rLibName, rDlgName ); - - return pDlgWin; + return bCreateIfNotExist ? CreateDlgWin(rDocument, rLibName, rDlgName) : 0; } sal_uInt16 BasicIDEShell::GetIDEWindowId(const IDEBaseWindow* pWin) const @@ -151,18 +138,17 @@ sal_uInt16 BasicIDEShell::GetIDEWindowId(const IDEBaseWindow* pWin) const SdrView* BasicIDEShell::GetCurDlgView() const { - if ( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) ) - return NULL; - - DialogWindow* pWin = (DialogWindow*)pCurWin; - return pWin->GetView(); + if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) + return pDCurWin->GetView(); + else + return 0; } // only if dialogue window above: void BasicIDEShell::ExecuteDialog( SfxRequest& rReq ) { - if ( pCurWin && ( pCurWin->IsA( TYPE( DialogWindow) ) || - (rReq.GetSlot() == SID_IMPORT_DIALOG &&pCurWin->IsA( TYPE( ModulWindow) ) ) ) ) + if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin) || + (rReq.GetSlot() == SID_IMPORT_DIALOG && dynamic_cast<ModulWindow*>(pCurWin)))) { pCurWin->ExecuteCommand( rReq ); } diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 7a8d733130ee..b59882c94229 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -251,19 +251,15 @@ BasicIDEShell::~BasicIDEShell() void BasicIDEShell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) { - if(pCurWin && pCurWin->IsA( TYPE(ModulWindow))) - { - dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay(SourceLinesDisplayed()); - } + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->SetLineNumberDisplay(SourceLinesDisplayed()); UpdateWindows(); } void BasicIDEShell::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) { - if(pCurWin && pCurWin->IsA( TYPE(ModulWindow))) - { - dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay(SourceLinesDisplayed()); - } + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + pMCurWin->SetLineNumberDisplay(SourceLinesDisplayed()); UpdateWindows(); } @@ -534,9 +530,9 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, { if ( BasicIDEGlobals::GetShell() ) { - if ( rHint.IsA( TYPE( SfxSimpleHint ) ) ) + if (SfxSimpleHint* pSimpleHint = dynamic_cast<SfxSimpleHint*>(&rHint)) { - switch ( ((SfxSimpleHint&)rHint).GetId() ) + switch (pSimpleHint->GetId()) { case SFX_HINT_DYING: { @@ -546,15 +542,13 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, break; } - if ( rHint.IsA( TYPE( SbxHint ) ) ) + if (SbxHint* pSbxHint = dynamic_cast<SbxHint*>(&rHint)) { - SbxHint& rSbxHint = (SbxHint&)rHint; - sal_uLong nHintId = rSbxHint.GetId(); + sal_uLong nHintId = pSbxHint->GetId(); if ( ( nHintId == SBX_HINT_BASICSTART ) || ( nHintId == SBX_HINT_BASICSTOP ) ) { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) { pBindings->Invalidate( SID_BASICRUN ); pBindings->Update( SID_BASICRUN ); diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 1479735e6738..61d9c53838fc 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -130,8 +130,7 @@ SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ) // update module in library ScriptDocument aDocument( ScriptDocument::NoDocument ); - SbxObject* pParent = pModule->GetParent(); - StarBASIC* pBasic = PTR_CAST(StarBASIC,pParent); + StarBASIC* pBasic = dynamic_cast<StarBASIC*>(pModule->GetParent()); DBG_ASSERT(pBasic, "BasicIDE::CreateMacro: No Basic found!"); if ( pBasic ) { @@ -246,11 +245,9 @@ bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& rLibN StarBASIC* FindBasic( const SbxVariable* pVar ) { const SbxVariable* pSbx = pVar; - while ( pSbx && !pSbx->ISA( StarBASIC ) ) + while (pSbx && !dynamic_cast<StarBASIC*>(pSbx)) pSbx = pSbx->GetParent(); - - DBG_ASSERT( !pSbx || pSbx->ISA( StarBASIC ), "Find Basic: Kein Basic!" ); - return (StarBASIC*)pSbx; + return static_cast<StarBASIC*>(pSbx); } //---------------------------------------------------------------------------- @@ -486,7 +483,7 @@ SfxBindings* GetBindingsPtr() while ( pView ) { SfxObjectShell* pObjShell = pView->GetObjectShell(); - if ( pObjShell && pObjShell->ISA( BasicDocShell ) ) + if (dynamic_cast<BasicDocShell*>(pObjShell)) { pFrame = pView; break; diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 3df5055a0cf7..45253e169eee 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -183,7 +183,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) break; case 0: { - aDocument = ((BasicDocumentEntry*)pEntry->GetUserData())->GetDocument(); + aDocument = static_cast<BasicDocumentEntry*>(pEntry->GetUserData())->GetDocument(); } break; } @@ -198,7 +198,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) { SvLBoxEntry* pLE = aEntries[n]; DBG_ASSERT( pLE, "Can not find entry in array" ); - BasicEntry* pBE = (BasicEntry*)pLE->GetUserData(); + BasicEntry* pBE = static_cast<BasicEntry*>(pLE->GetUserData()); DBG_ASSERT( pBE, "The data in the entry not found!" ); String aName( GetEntryText( pLE ) ); @@ -206,27 +206,26 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) { case OBJ_TYPE_LIBRARY: { - BasicManager* pBasMgr = aDocument.getBasicManager(); - if ( pBasMgr ) + if (BasicManager* pBasMgr = aDocument.getBasicManager()) pVar = pBasMgr->GetLib( aName ); } break; case OBJ_TYPE_MODULE: { - DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" ); + DBG_ASSERT(dynamic_cast<StarBASIC*>(pVar), "FindVariable: invalid Basic"); // extract the module name from the string like "Sheet1 (Example1)" if( bDocumentObjects ) { sal_uInt16 nIndex = 0; aName = aName.GetToken( 0, ' ', nIndex ); } - pVar = ((StarBASIC*)pVar)->FindModule( aName ); + pVar = static_cast<StarBASIC*>(pVar)->FindModule( aName ); } break; case OBJ_TYPE_METHOD: { - DBG_ASSERT( pVar && ( (pVar->IsA( TYPE(SbModule) )) || (pVar->IsA( TYPE(SbxObject) )) ), "FindVariable: Ungueltiges Modul/Objekt" ); - pVar = ((SbxObject*)pVar)->GetMethods()->Find( aName, SbxCLASS_METHOD ); + DBG_ASSERT(dynamic_cast<SbxObject*>(pVar), "FindVariable: invalid modul/object"); + pVar = static_cast<SbxObject*>(pVar)->GetMethods()->Find(aName, SbxCLASS_METHOD); } break; case OBJ_TYPE_DIALOG: @@ -288,8 +287,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) break; case 0: { - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pEntry->GetUserData(); - if ( pBasicDocumentEntry ) + if (BasicDocumentEntry* pBasicDocumentEntry = static_cast<BasicDocumentEntry*>(pEntry->GetUserData())) { aDocument = pBasicDocumentEntry->GetDocument(); eLocation = pBasicDocumentEntry->GetLocation(); @@ -307,7 +305,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) { SvLBoxEntry* pLE = aEntries[n]; DBG_ASSERT( pLE, "Entrie im Array nicht gefunden" ); - BasicEntry* pBE = (BasicEntry*)pLE->GetUserData(); + BasicEntry* pBE = static_cast<BasicEntry*>(pLE->GetUserData()); DBG_ASSERT( pBE, "Keine Daten im Eintrag gefunden!" ); switch ( pBE->GetType() ) @@ -455,10 +453,7 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) SbModule* BasicTreeListBox::FindModule( SvLBoxEntry* pEntry ) { - SbxVariable* pVar = FindVariable( pEntry ); - if ( pVar && pVar->IsA( TYPE(SbModule ) ) ) - return (SbModule*)pVar; - return 0; + return dynamic_cast<SbModule*>(FindVariable(pEntry)); } SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) @@ -468,9 +463,9 @@ SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, L SvLBoxEntry* pRootEntry = GetEntry( nRootPos ); while ( pRootEntry ) { - DBG_ASSERT( (((BasicEntry*)pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT ), "Kein Shelleintrag?" ); - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pRootEntry->GetUserData(); - if ( pBasicDocumentEntry && ( pBasicDocumentEntry->GetDocument() == rDocument ) && pBasicDocumentEntry->GetLocation() == eLocation ) + DBG_ASSERT( static_cast<BasicEntry*>(pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT, "Kein Shelleintrag?" ); + BasicDocumentEntry* pBDEntry = static_cast<BasicDocEntry*>(pRootEntry->GetUserData()); + if (pBDEntry && pBDEntry->GetDocument() == rDocument && pBDEntry->GetLocation() == eLocation) return pRootEntry; pRootEntry = GetEntry( ++nRootPos ); } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 7ca8c569b62b..ded9595bebb1 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -444,15 +444,13 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) if ( aDocument.isInVBAMode() ) { // disable to delete or remove object modules in IDE - BasicManager* pBasMgr = aDocument.getBasicManager(); - if ( pBasMgr ) + if (BasicManager* pBasMgr = aDocument.getBasicManager()) { - StarBASIC* pBasic = pBasMgr->GetLib( aOULibName ); - if( pBasic ) + if (StarBASIC* pBasic = pBasMgr->GetLib(aOULibName)) { IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); IDEWindowTable::const_iterator it = aIDEWindowTable.find( GetCurPageId() ); - if( it != aIDEWindowTable.end() && it->second->ISA( ModulWindow ) ) + if (it != aIDEWindowTable.end() && dynamic_cast<ModulWindow*>(it->second)) { SbModule* pActiveModule = (SbModule*)pBasic->FindModule( it->second->GetName() ); if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) ) @@ -467,10 +465,10 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) } - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - pDispatcher->Execute( aPopup.Execute( this, aPos ) ); + if (pIDEShell) + if (SfxViewFrame* pViewFrame = pIDEShell->GetViewFrame()) + if (SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher()) + pDispatcher->Execute(aPopup.Execute(this, aPos)); } } @@ -523,11 +521,11 @@ void BasicIDETabBar::Sort() aTabBarSortHelper.aPageText = GetPageText( nId ); IDEBaseWindow* pWin = aIDEWindowTable[ nId ]; - if ( pWin->IsA( TYPE( ModulWindow ) ) ) + if (dynamic_cast<ModulWindow*>(pWin)) { aModuleList.push_back( aTabBarSortHelper ); } - else if ( pWin->IsA( TYPE( DialogWindow ) ) ) + else if (dynamic_cast<DialogWindow*>(pWin)) { aDialogList.push_back( aTabBarSortHelper ); } diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 9097531a7440..1786e490325f 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -135,9 +135,8 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou { String aDlgName = pDlgNames[ i ]; DialogWindow* pWin = m_pIDEShell->FindDlgWin( m_aDocument, m_aLibName, aDlgName, false ); - if( pWin && pWin->IsA( TYPE( DialogWindow ) ) ) + if (DialogWindow* pDialogWin = dynamic_cast<DialogWindow*>(pWin)) { - DialogWindow* pDialogWin = static_cast< DialogWindow* >( pWin ); Reference< container::XNameContainer > xDialog = pDialogWin->GetDialog(); if( xDialog.is() ) { @@ -778,14 +777,10 @@ void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLo if ( pBindings ) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - IDEBaseWindow* pCurWin = m_pIDEShell->GetCurWindow(); - if ( pCurWin && !pCurWin->IsSuspended() && pCurWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDlgWin = (DialogWindow*)pCurWin; - DlgEditor* pWinEditor = pDlgWin->GetEditor(); - if( pWinEditor ) - pWinEditor->UpdatePropertyBrowserDelayed(); - } + if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(m_pIDEShell->GetCurWindow())) + if (!pDlgWin->IsSuspended()) + if (DlgEditor* pWinEditor = pDlgWin->GetEditor()) + pWinEditor->UpdatePropertyBrowserDelayed(); } } @@ -812,22 +807,18 @@ DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor ) { BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - DialogWindow* pFoundDlgWin = NULL; for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) { IDEBaseWindow* pWin = it->second; - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDlgWin = (DialogWindow*)pWin; - DlgEditor* pWinEditor = pDlgWin->GetEditor(); - if( pWinEditor == pEditor ) + if (!pWin->IsSuspended()) + if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin)) { - pFoundDlgWin = pDlgWin; - break; + DlgEditor* pWinEditor = pDlgWin->GetEditor(); + if( pWinEditor == pEditor ) + return pFoundDlgWin; } - } } - return pFoundDlgWin; + return 0; } diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index 0eb52cbf85f4..ab75ee8ad34b 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -55,13 +55,15 @@ SfxPoolItem *SbxItem::Clone(SfxItemPool*) const int SbxItem::operator==(const SfxPoolItem& rCmp) const { - DBG_ASSERT( rCmp.ISA( SbxItem ), "==: Kein SbxItem!" ); - return (SfxPoolItem::operator==(rCmp) && - m_aDocument == ((const SbxItem&)rCmp).m_aDocument && - m_aLibName == ((const SbxItem&)rCmp).m_aLibName && - m_aName == ((const SbxItem&)rCmp).m_aName && - m_aMethodName == ((const SbxItem&)rCmp).m_aMethodName && - m_nType == ((const SbxItem&)rCmp).m_nType); + SbxItem const* pSbxItem = dynamic_cast<SbxItem const*>(&rCmp); + DBG_ASSERT(pSbxItem, "==: no SbxItem!" ); + return + SfxPoolItem::operator==(rCmp) && + m_aDocument == pSbxItem->m_aDocument && + m_aLibName == pSbxItem->m_aLibName && + m_aName == pSbxItem->m_aName && + m_aMethodName == pSbxItem->m_aMethodName && + m_nType == pSbxItem->m_nType; } const ScriptDocument& SbxItem::GetDocument() const diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx index 171fa00f51c7..a80381b276de 100644 --- a/basctl/source/basicide/tbxctl.cxx +++ b/basctl/source/basicide/tbxctl.cxx @@ -67,12 +67,10 @@ void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState, { if( pState ) { - SfxAllEnumItem* pItem = PTR_CAST(SfxAllEnumItem, pState); - if( pItem ) + if (SfxAllEnumItem* pItem = dynamic_cast<SfxAllEnumItem*>(pState)) { - sal_uInt16 nLastEnum = pItem->GetValue(); sal_uInt16 nTemp = 0; - switch( nLastEnum ) + switch (sal_uInt16 nLastEnum = pItem->GetValue()) { case SVX_SNAP_PUSHBUTTON: nTemp = SID_INSERT_PUSHBUTTON; break; case SVX_SNAP_CHECKBOX: nTemp = SID_INSERT_CHECKBOX; break; diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 391663646e57..bab57fbd5cbb 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -561,12 +561,9 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) if ( pDlgEdPage && ( ( nObjCount = pDlgEdPage->GetObjCount() ) > 0 ) ) { for ( sal_uLong i = 0 ; i < nObjCount ; i++ ) - { - SdrObject* pObj = pDlgEdPage->GetObj(i); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) - pDlgEdObj->SetRectFromProps(); - } + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pDlgEdPage->GetObj(i))) + if (!dynamic_cast<DlgEdForm*>(pDlgEdObj)) + pDlgEdObj->SetRectFromProps(); } } } @@ -668,8 +665,7 @@ void DlgEditor::CreateDefaultObject() // create object by factory SdrObject* pObj = SdrObjFactory::MakeNewObject( pDlgEdView->GetCurrentObjInventor(), pDlgEdView->GetCurrentObjIdentifier(), pDlgEdPage ); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj)) { // set position and size Size aSize = pWindow->PixelToLogic( Size( 96, 24 ) ); @@ -746,9 +742,9 @@ void DlgEditor::Copy() for( sal_uLong i = 0; i < nMark; i++ ) { SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj(); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); + DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj); - if (pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) + if (pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj)) { ::rtl::OUString aName; Reference< beans::XPropertySet > xMarkPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY); @@ -1070,9 +1066,9 @@ void DlgEditor::Delete() for( sal_uLong i = 0; i < nMark; i++ ) { SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj(); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); + DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj); - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) + if ( pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj) ) { // get name from property ::rtl::OUString aName; diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index 6dbcc48e967a..4c66c99a8889 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -509,7 +509,7 @@ bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt ) { if( pView->PickObj( aMDPos, nHitLog, pObj, pPV ) ) { - //if( pObj->ISA( DlgEdForm ) ) + //if (dynamic_cast<DlgEdForm*>(pObj)) // pView->UnmarkAll(); //else // pParent->UnmarkDialog(); diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index df7ed2bf0282..41ae1cb0ee0b 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -51,6 +51,14 @@ using ::rtl::OUString; TYPEINIT1(DlgEdObj, SdrUnoObj); DBG_NAME(DlgEdObj); +DlgEditor* DlgEdObj::GetDialogEditor () +{ + if (DlgEdForm* pFormThis = dynamic_cast<DlgEdForm*>(this)) + return pFormThis->GetDlgEditor(); + else + return pDlgEdForm->GetDlgEditor(); +} + //---------------------------------------------------------------------------- DlgEdObj::DlgEdObj() @@ -512,12 +520,9 @@ void SAL_CALL DlgEdObj::NameChange( const ::com::sun::star::beans::PropertyChan xCont->removeByName( aOldName ); xCont->insertByName( aNewName , aAny ); - DlgEditor* pEditor; - if ( ISA(DlgEdForm) ) - pEditor = ((DlgEdForm*)this)->GetDlgEditor(); - else - pEditor = GetDlgEdForm()->GetDlgEditor(); - LocalizationMgr::renameControlResourceIDsForEditorObject( pEditor, aAny, aNewName ); + LocalizationMgr::renameControlResourceIDsForEditorObject( + GetDialogEditor(), aAny, aNewName + ); } } else @@ -1104,12 +1109,9 @@ void DlgEdObj::SetDefaults() aAny <<= xCtrl; xCont->insertByName( aOUniqueName , aAny ); - DlgEditor* pEditor; - if ( ISA(DlgEdForm) ) - pEditor = ((DlgEdForm*)this)->GetDlgEditor(); - else - pEditor = GetDlgEdForm()->GetDlgEditor(); - LocalizationMgr::setControlResourceIDsForNewEditorObject( pEditor, aAny, aOUniqueName ); + LocalizationMgr::setControlResourceIDsForNewEditorObject( + GetDialogEditor(), aAny, aOUniqueName + ); // #110559# pDlgEdForm->UpdateTabOrderAndGroups(); @@ -1222,20 +1224,13 @@ void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::Propert PositionAndSizeChange( evt ); if ( evt.PropertyName == DLGED_PROP_DECORATION ) - { - if ( ISA(DlgEdForm) ) - ((DlgEdForm*)this)->GetDlgEditor()->ResetDialog(); - else - GetDlgEdForm()->GetDlgEditor()->ResetDialog(); - } + GetDialogEditor()->ResetDialog(); } // change name of control in dialog model else if ( evt.PropertyName == DLGED_PROP_NAME ) { - if ( !ISA(DlgEdForm) ) - { + if (!dynamic_cast<DlgEdForm*>(this)) NameChange(evt); - } } // update step else if ( evt.PropertyName == DLGED_PROP_STEP ) @@ -1245,10 +1240,8 @@ void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::Propert // change tabindex else if ( evt.PropertyName == DLGED_PROP_TABINDEX ) { - if ( !ISA(DlgEdForm) ) - { + if (!dynamic_cast<DlgEdForm>(this)) TabIndexChange(evt); - } } } } @@ -1260,14 +1253,7 @@ void SAL_CALL DlgEdObj::_elementInserted(const ::com::sun::star::container::Cont if (isListening()) { // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(true); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(true); - } + GetDialogEditor()->SetDialogModelChanged(true); } } @@ -1278,14 +1264,7 @@ void SAL_CALL DlgEdObj::_elementReplaced(const ::com::sun::star::container::Cont if (isListening()) { // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(true); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(true); - } + GetDialogEditor()->SetDialogModelChanged(true); } } @@ -1296,14 +1275,7 @@ void SAL_CALL DlgEdObj::_elementRemoved(const ::com::sun::star::container::Conta if (isListening()) { // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(true); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(true); - } + GetDialogEditor()->SetDialogModelChanged(true); } } @@ -1567,9 +1539,8 @@ void DlgEdForm::UpdateStep() { for ( sal_uLong i = 0 ; i < nObjCount ; i++ ) { - SdrObject* pObj = pSdrPage->GetObj(i); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) + DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i)); + if (pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj)) pDlgEdObj->UpdateStep(); } } diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 673af7b1e3ba..3af451b85506 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -281,8 +281,7 @@ Sequence< Reference< XInterface > > while (pCurrent) { - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pCurrent); - if (pDlgEdObj) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pCurrent)) { Reference< XInterface > xControlInterface(pDlgEdObj->GetUnoControlModel(), UNO_QUERY); if (xControlInterface.is()) @@ -525,8 +524,7 @@ void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView Sequence< Reference< XInterface > > aNewObjects; if ( nMarkCount == 1 ) { - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, rMarkList.GetMark(0)->GetMarkedSdrObj() ); - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rMarkList.GetMark(0)->GetMarkedSdrObj())) { if ( pDlgEdObj->IsGroupObject() ) // group object aNewObjects = CreateMultiSelectionSequence( rMarkList ); diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index ffd7f60ac6d0..7be6a2eeb188 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -51,6 +51,9 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener; +private: + DlgEditor* GetDialogEditor (); + protected: DlgEdObj(); DlgEdObj(const ::rtl::OUString& rModelName, |