diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-02-20 16:03:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-02-21 08:09:46 +0100 |
commit | ba8a70365ef459c967cd8a71a6d48ca53dd341bd (patch) | |
tree | 397ae034cac2f06ea40ed550a7ce39cf4a42966e /svtools/source | |
parent | 0adb36835bcbe55bdf2717556a98e51f1873b19f (diff) |
New loplugin:nestedunnamed
Change-Id: Ifb434589ef08428ce609bc7a40b015d4df13224c
Reviewed-on: https://gerrit.libreoffice.org/50048
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/uno/wizard/unowizard.cxx | 91 |
1 files changed, 39 insertions, 52 deletions
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index c44c8de02a8f..9906d34e5ffe 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -67,23 +67,19 @@ namespace { namespace WizardButton = css::ui::dialogs::WizardButton; - - namespace + WizardButtonFlags lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton ) { - WizardButtonFlags lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton ) + switch ( i_nWizardButton ) { - switch ( i_nWizardButton ) - { - case WizardButton::NONE: return WizardButtonFlags::NONE; - case WizardButton::NEXT: return WizardButtonFlags::NEXT; - case WizardButton::PREVIOUS: return WizardButtonFlags::PREVIOUS; - case WizardButton::FINISH: return WizardButtonFlags::FINISH; - case WizardButton::CANCEL: return WizardButtonFlags::CANCEL; - case WizardButton::HELP: return WizardButtonFlags::HELP; - } - OSL_FAIL( "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); - return WizardButtonFlags::NONE; + case WizardButton::NONE: return WizardButtonFlags::NONE; + case WizardButton::NEXT: return WizardButtonFlags::NEXT; + case WizardButton::PREVIOUS: return WizardButtonFlags::PREVIOUS; + case WizardButton::FINISH: return WizardButtonFlags::FINISH; + case WizardButton::CANCEL: return WizardButtonFlags::CANCEL; + case WizardButton::HELP: return WizardButtonFlags::HELP; } + OSL_FAIL( "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); + return WizardButtonFlags::NONE; } typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoDialog @@ -147,8 +143,6 @@ namespace { { } - namespace { - OUString lcl_getHelpURL( const OString& sHelpId ) { OUStringBuffer aBuffer; @@ -161,8 +155,6 @@ namespace { return aBuffer.makeStringAndClear(); } - } - Wizard::~Wizard() { if ( m_pDialog ) @@ -176,53 +168,48 @@ namespace { } } - - namespace + void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext ) { - void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext ) + // need at least one path + if ( i_rPaths.getLength() == 0 ) + throw IllegalArgumentException( OUString(), i_rContext, 2 ); + + // each path must be of length 1, at least + for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) { - // need at least one path - if ( i_rPaths.getLength() == 0 ) + if ( i_rPaths[i].getLength() == 0 ) throw IllegalArgumentException( OUString(), i_rContext, 2 ); - // each path must be of length 1, at least - for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) + // page IDs must be in ascending order + sal_Int16 nPreviousPageID = i_rPaths[i][0]; + for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j ) { - if ( i_rPaths[i].getLength() == 0 ) - throw IllegalArgumentException( OUString(), i_rContext, 2 ); - - // page IDs must be in ascending order - sal_Int16 nPreviousPageID = i_rPaths[i][0]; - for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j ) + if ( i_rPaths[i][j] <= nPreviousPageID ) { - if ( i_rPaths[i][j] <= nPreviousPageID ) - { - throw IllegalArgumentException( - "Path " + OUString::number(i) - + ": invalid page ID sequence - each page ID must be greater than the previous one.", - i_rContext, 2 ); - } - nPreviousPageID = i_rPaths[i][j]; + throw IllegalArgumentException( + "Path " + OUString::number(i) + + ": invalid page ID sequence - each page ID must be greater than the previous one.", + i_rContext, 2 ); } + nPreviousPageID = i_rPaths[i][j]; } + } - // if we have one path, that's okay - if ( i_rPaths.getLength() == 1 ) - return; + // if we have one path, that's okay + if ( i_rPaths.getLength() == 1 ) + return; - // if we have multiple paths, they must start with the same page id - const sal_Int16 nFirstPageId = i_rPaths[0][0]; - for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) - { - if ( i_rPaths[i][0] != nFirstPageId ) - throw IllegalArgumentException( - "All paths must start with the same page id.", - i_rContext, 2 ); - } + // if we have multiple paths, they must start with the same page id + const sal_Int16 nFirstPageId = i_rPaths[0][0]; + for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) + { + if ( i_rPaths[i][0] != nFirstPageId ) + throw IllegalArgumentException( + "All paths must start with the same page id.", + i_rContext, 2 ); } } - void SAL_CALL Wizard::initialize( const Sequence< Any >& i_Arguments ) { ::osl::MutexGuard aGuard( m_aMutex ); |