summaryrefslogtreecommitdiff
path: root/vbahelper/source
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-05 11:22:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-05 13:50:05 +0100
commit349099b4e0fa59c3f340d3a1fb175db04220708a (patch)
tree328e4ffe82c3c49c6e113c5688c7ea7545040e00 /vbahelper/source
parent9498a5dd652db72b15f97560ce1fd758748fb64c (diff)
loplugin:reducevarscope in vbahelper
Change-Id: I4cc99067ab39fb95aec2d608e3240340749f2bf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105330 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper/source')
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx5
-rw-r--r--vbahelper/source/vbahelper/vbadialogbase.cxx3
-rw-r--r--vbahelper/source/vbahelper/vbapagesetupbase.cxx8
3 files changed, 7 insertions, 9 deletions
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 7c56bd2bbff4..2b7c92374fcf 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -424,11 +424,10 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
{
- OUString aControlName;
- sal_Int32 nIndex = -1;
-
try
{
+ OUString aControlName;
+ sal_Int32 nIndex = -1;
if ( !mxDialog.is() )
throw uno::RuntimeException();
diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx
index 605a9c76f7eb..6e5ae97857b1 100644
--- a/vbahelper/source/vbahelper/vbadialogbase.cxx
+++ b/vbahelper/source/vbahelper/vbadialogbase.cxx
@@ -25,10 +25,9 @@ using namespace ::com::sun::star;
void SAL_CALL VbaDialogBase::Show()
{
- OUString aURL;
if ( m_xModel.is() )
{
- aURL = mapIndexToName( mnIndex );
+ OUString aURL = mapIndexToName( mnIndex );
if( aURL.isEmpty() )
throw uno::RuntimeException( "Unable to open the specified dialog" );
diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx
index c29b166c69ca..d50fe188c193 100644
--- a/vbahelper/source/vbahelper/vbapagesetupbase.cxx
+++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx
@@ -38,7 +38,6 @@ double SAL_CALL VbaPageSetupBase::getTopMargin()
try
{
bool headerOn = false;
- sal_Int32 headerHeight = 0;
uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" );
aValue >>= headerOn;
@@ -48,6 +47,7 @@ double SAL_CALL VbaPageSetupBase::getTopMargin()
if( headerOn )
{
+ sal_Int32 headerHeight = 0;
aValue = mxPageProps->getPropertyValue( "HeaderHeight" );
aValue >>= headerHeight;
topMargin = topMargin + headerHeight;
@@ -67,13 +67,13 @@ void SAL_CALL VbaPageSetupBase::setTopMargin( double margin )
try
{
bool headerOn = false;
- sal_Int32 headerHeight = 0;
uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" );
aValue >>= headerOn;
if( headerOn )
{
+ sal_Int32 headerHeight = 0;
aValue = mxPageProps->getPropertyValue( "HeaderHeight" );
aValue >>= headerHeight;
topMargin -= headerHeight;
@@ -93,7 +93,6 @@ double SAL_CALL VbaPageSetupBase::getBottomMargin()
try
{
bool footerOn = false;
- sal_Int32 footerHeight = 0;
uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" );
aValue >>= footerOn;
@@ -103,6 +102,7 @@ double SAL_CALL VbaPageSetupBase::getBottomMargin()
if( footerOn )
{
+ sal_Int32 footerHeight = 0;
aValue = mxPageProps->getPropertyValue( "FooterHeight" );
aValue >>= footerHeight;
bottomMargin += footerHeight;
@@ -122,13 +122,13 @@ void SAL_CALL VbaPageSetupBase::setBottomMargin( double margin )
try
{
bool footerOn = false;
- sal_Int32 footerHeight = 0;
uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" );
aValue >>= footerOn;
if( footerOn )
{
+ sal_Int32 footerHeight = 0;
aValue = mxPageProps->getPropertyValue( "FooterHeight" );
aValue >>= footerHeight;
bottomMargin -= footerHeight;