diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 13:29:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 13:43:06 +0100 |
commit | 26f46b861d8504033685b2eec4d003eef8109a27 (patch) | |
tree | d35bf900af9e17f0f7e17348c14aef9df74ef579 /basctl | |
parent | ca28826a087245686d7fca3ffc8ca1f03307924d (diff) |
loplugin:flatten in accessibility..basic
Change-Id: If2cc282c2b135d634daf393a082c29049b10a677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/basobj2.cxx | 41 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 32 | ||||
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 29 |
3 files changed, 51 insertions, 51 deletions
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index f14535cbd3f1..28c1acdb383f 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -160,27 +160,28 @@ bool RenameModule ( if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) ) return false; - if (Shell* pShell = GetShell()) + Shell* pShell = GetShell(); + if (!pShell) + return true; + VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true); + if (!pWin) + return true; + + // set new name in window + pWin->SetName( rNewName ); + + // set new module in module window + pWin->SetSbModule( pWin->GetBasic()->FindModule( rNewName ) ); + + // update tabwriter + sal_uInt16 nId = pShell->GetWindowId( pWin ); + SAL_WARN_IF( nId == 0 , "basctl.basicide", "No entry in Tabbar!"); + if ( nId ) { - if (VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true)) - { - // set new name in window - pWin->SetName( rNewName ); - - // set new module in module window - pWin->SetSbModule( pWin->GetBasic()->FindModule( rNewName ) ); - - // update tabwriter - sal_uInt16 nId = pShell->GetWindowId( pWin ); - SAL_WARN_IF( nId == 0 , "basctl.basicide", "No entry in Tabbar!"); - if ( nId ) - { - TabBar& rTabBar = pShell->GetTabBar(); - rTabBar.SetPageText(nId, rNewName); - rTabBar.Sort(); - rTabBar.MakeVisible(rTabBar.GetCurPageId()); - } - } + TabBar& rTabBar = pShell->GetTabBar(); + rTabBar.SetPageText(nId, rNewName); + rTabBar.Sort(); + rTabBar.MakeVisible(rTabBar.GetCurPageId()); } return true; } diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 06f7c6a9e08c..26de81e35cb9 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -180,24 +180,24 @@ bool RenameDialog ( if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) ) return false; - if (pWin && pShell) - { - // set new name in window - pWin->SetName( rNewName ); + if (!pWin || !pShell) + return true; - // update property browser - pWin->UpdateBrowser(); + // set new name in window + pWin->SetName( rNewName ); - // update tabwriter - sal_uInt16 nId = pShell->GetWindowId( pWin ); - DBG_ASSERT( nId, "No entry in Tabbar!" ); - if ( nId ) - { - TabBar& rTabBar = pShell->GetTabBar(); - rTabBar.SetPageText( nId, rNewName ); - rTabBar.Sort(); - rTabBar.MakeVisible( rTabBar.GetCurPageId() ); - } + // update property browser + pWin->UpdateBrowser(); + + // update tabwriter + sal_uInt16 nId = pShell->GetWindowId( pWin ); + DBG_ASSERT( nId, "No entry in Tabbar!" ); + if ( nId ) + { + TabBar& rTabBar = pShell->GetTabBar(); + rTabBar.SetPageText( nId, rNewName ); + rTabBar.Sort(); + rTabBar.MakeVisible( rTabBar.GetCurPageId() ); } return true; } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index fcef9e78802b..e23cfbe7a113 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -509,25 +509,24 @@ namespace basctl bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName ) { OSL_ENSURE( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" ); - if ( isValid() ) + if ( !isValid() ) + return false; + try { - try - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) ); - if ( xLib.is() ) - { - xLib->removeByName( _rModuleName ); - Reference< XVBAModuleInfo > xVBAModuleInfo(xLib, UNO_QUERY); - if(xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo(_rModuleName)) - xVBAModuleInfo->removeModuleInfo(_rModuleName); - return true; - } - } - catch( const Exception& ) + Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) ); + if ( xLib.is() ) { - DBG_UNHANDLED_EXCEPTION("basctl.basicide"); + xLib->removeByName( _rModuleName ); + Reference< XVBAModuleInfo > xVBAModuleInfo(xLib, UNO_QUERY); + if(xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo(_rModuleName)) + xVBAModuleInfo->removeModuleInfo(_rModuleName); + return true; } } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("basctl.basicide"); + } return false; } |