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 /sw/source/uibase/uno/unotxvw.cxx | |
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 'sw/source/uibase/uno/unotxvw.cxx')
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 3515f1f34f5e..df3b8c3a164a 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -740,40 +740,38 @@ uno::Any SAL_CALL SwXTextView::getPropertyValue( const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName ); if (!pEntry) throw UnknownPropertyException(); - else + + sal_Int16 nWID = pEntry->nWID; + switch (nWID) { - sal_Int16 nWID = pEntry->nWID; - switch (nWID) + case WID_PAGE_COUNT : + case WID_LINE_COUNT : { - case WID_PAGE_COUNT : - case WID_LINE_COUNT : - { - // format document completely in order to get meaningful - // values for page count and line count - m_pView->GetWrtShell().CalcLayout(); - - sal_Int32 nCount = -1; - if (nWID == WID_PAGE_COUNT) - nCount = m_pView->GetWrtShell().GetPageCount(); - else // WID_LINE_COUNT - nCount = m_pView->GetWrtShell().GetLineCount(); - aRet <<= nCount; - } - break; - case WID_IS_HIDE_SPELL_MARKS : - // deprecated #i91949 - break; - case WID_IS_CONSTANT_SPELLCHECK : - { - const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); - if (!pOpt) - throw RuntimeException(); - aRet <<= bool(pOpt->GetCoreOptions() & ViewOptFlags1::OnlineSpell); - } - break; - default : - OSL_FAIL("unknown WID"); + // format document completely in order to get meaningful + // values for page count and line count + m_pView->GetWrtShell().CalcLayout(); + + sal_Int32 nCount = -1; + if (nWID == WID_PAGE_COUNT) + nCount = m_pView->GetWrtShell().GetPageCount(); + else // WID_LINE_COUNT + nCount = m_pView->GetWrtShell().GetLineCount(); + aRet <<= nCount; + } + break; + case WID_IS_HIDE_SPELL_MARKS : + // deprecated #i91949 + break; + case WID_IS_CONSTANT_SPELLCHECK : + { + const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); + if (!pOpt) + throw RuntimeException(); + aRet <<= bool(pOpt->GetCoreOptions() & ViewOptFlags1::OnlineSpell); } + break; + default : + OSL_FAIL("unknown WID"); } return aRet; |