From 1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Sep 2017 10:33:09 +0200 Subject: 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 Reviewed-by: Noel Grandin --- sw/source/uibase/uno/unotxvw.cxx | 60 +++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 31 deletions(-) (limited to 'sw/source/uibase/uno/unotxvw.cxx') 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; -- cgit