From 5901827bd44dc3600bf66c83882e6847439d59d6 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 17 Jan 2015 00:37:31 +0100 Subject: fdo#39440 reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I1cd8b118e2598b8b18fb445851a3bb41e554267b Reviewed-on: https://gerrit.libreoffice.org/13967 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vbahelper/source/vbahelper/vbapagesetupbase.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx index 46e8203a40ee..0148234d9ad0 100644 --- a/vbahelper/source/vbahelper/vbapagesetupbase.cxx +++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx @@ -31,12 +31,13 @@ VbaPageSetupBase::VbaPageSetupBase(const uno::Reference< XHelperInterface >& xPa double SAL_CALL VbaPageSetupBase::getTopMargin() throw (css::uno::RuntimeException, std::exception) { - bool headerOn = false; sal_Int32 topMargin = 0; - sal_Int32 headerHeight = 0; try { + bool headerOn = false; + sal_Int32 headerHeight = 0; + uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" ); aValue >>= headerOn; @@ -60,11 +61,12 @@ double SAL_CALL VbaPageSetupBase::getTopMargin() throw (css::uno::RuntimeExcepti void SAL_CALL VbaPageSetupBase::setTopMargin( double margin ) throw (css::uno::RuntimeException, std::exception) { sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - bool headerOn = false; - sal_Int32 headerHeight = 0; try { + bool headerOn = false; + sal_Int32 headerHeight = 0; + uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" ); aValue >>= headerOn; @@ -85,12 +87,13 @@ void SAL_CALL VbaPageSetupBase::setTopMargin( double margin ) throw (css::uno::R double SAL_CALL VbaPageSetupBase::getBottomMargin() throw (css::uno::RuntimeException, std::exception) { - bool footerOn = false; sal_Int32 bottomMargin = 0; - sal_Int32 footerHeight = 0; try { + bool footerOn = false; + sal_Int32 footerHeight = 0; + uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" ); aValue >>= footerOn; @@ -114,11 +117,12 @@ double SAL_CALL VbaPageSetupBase::getBottomMargin() throw (css::uno::RuntimeExce void SAL_CALL VbaPageSetupBase::setBottomMargin( double margin ) throw (css::uno::RuntimeException, std::exception) { sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - bool footerOn = false; - sal_Int32 footerHeight = 0; try { + bool footerOn = false; + sal_Int32 footerHeight = 0; + uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" ); aValue >>= footerOn; -- cgit v1.2.3