diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-28 10:33:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-29 08:51:48 +0200 |
commit | 1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 (patch) | |
tree | 5da59640441292421f2137bc85ee7291daed137e /sfx2 | |
parent | ce9a41dc387966c74c1af92783a97565b5af3668 (diff) |
loplugin:flatten check for throw in then clause
also make the plugin ignore the case where we have var decl's in the
clause we want to flatten, which could lead to problematic extension of
variable lifetime
Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59
Reviewed-on: https://gerrit.libreoffice.org/42889
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 31 |
2 files changed, 15 insertions, 21 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 3e02827bbe6e..e5c85169c7c9 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -404,10 +404,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > { throw css::lang::IllegalArgumentException(); } - else - { - aSetPaperSize = impl_Size_Struct2Object(aTempSize); - } + aSetPaperSize = impl_Size_Struct2Object(aTempSize); } // PrinterTray-Property diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 944485fbc4bf..a18de4f77171 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -310,34 +310,31 @@ const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const { if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size()) throw RuntimeException(); - else - return maItems[nIndex].msDeckId; + return maItems[nIndex].msDeckId; } void TabBar::ToggleHideFlag (const sal_Int32 nIndex) { if (nIndex<0 || static_cast<size_t>(nIndex) >= maItems.size()) throw RuntimeException(); - else - { - maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden; - std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId); - if (xDeckDescriptor) - { - xDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden; + maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden; - Context aContext; - aContext.msApplication = pParentSidebarController->GetCurrentContext().msApplication; - // leave aContext.msContext on default 'any' ... this func is used only for decks - // and we don't have context-sensitive decks anyway + std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId); + if (xDeckDescriptor) + { + xDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden; - xDeckDescriptor->maContextList.ToggleVisibilityForContext( - aContext, xDeckDescriptor->mbIsEnabled ); - } + Context aContext; + aContext.msApplication = pParentSidebarController->GetCurrentContext().msApplication; + // leave aContext.msContext on default 'any' ... this func is used only for decks + // and we don't have context-sensitive decks anyway - Layout(); + xDeckDescriptor->maContextList.ToggleVisibilityForContext( + aContext, xDeckDescriptor->mbIsEnabled ); } + + Layout(); } void TabBar::RestoreHideFlags() |