diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-25 18:56:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-27 10:10:52 +0200 |
commit | f3049f68584811bb897873f35e0c302898af2d31 (patch) | |
tree | b77f8bee3f733b8f2565a64276e33387576a26ac /vcl | |
parent | 28fc0962b10519ab84654d189d2ad0cca8f84f95 (diff) |
loplugin:constantparam
Change-Id: I966dcf87be021520e7cc394338b9c0574bb8afee
Reviewed-on: https://gerrit.libreoffice.org/53541
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/longcurr.cxx | 57 | ||||
-rw-r--r-- | vcl/source/window/menuitemlist.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/menuitemlist.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 4 |
4 files changed, 29 insertions, 38 deletions
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index dc15721dc8fa..183782037716 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -92,9 +92,8 @@ OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt return aTemplate.makeStringAndClear(); } -bool ImplNumericGetValue( const OUString& rStr, BigInt& rValue, - sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, - bool bCurrency ) +bool ImplCurrencyGetValue( const OUString& rStr, BigInt& rValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper ) { OUString aStr = rStr; OUStringBuffer aStr1; @@ -123,13 +122,28 @@ bool ImplNumericGetValue( const OUString& rStr, BigInt& rValue, aStr1 = aStr; // Negative? - if ( bCurrency ) + if ( (aStr[ 0 ] == '(') && (aStr[ aStr.getLength()-1 ] == ')') ) + bNegative = true; + if ( !bNegative ) { - if ( (aStr[ 0 ] == '(') && (aStr[ aStr.getLength()-1 ] == ')') ) - bNegative = true; - if ( !bNegative ) + for (sal_Int32 i=0; i < aStr.getLength(); i++ ) + { + if ( (aStr[ i ] >= '0') && (aStr[ i ] <= '9') ) + break; + else if ( aStr[ i ] == '-' ) + { + bNegative = true; + break; + } + } + } + if ( !bNegative && !aStr.isEmpty() ) + { + sal_uInt16 nFormat = rLocaleDataWrapper.getCurrNegativeFormat(); + if ( (nFormat == 3) || (nFormat == 6) || + (nFormat == 7) || (nFormat == 10) ) { - for (sal_Int32 i=0; i < aStr.getLength(); i++ ) + for (sal_Int32 i = aStr.getLength()-1; i > 0; i++ ) { if ( (aStr[ i ] >= '0') && (aStr[ i ] <= '9') ) break; @@ -140,29 +154,6 @@ bool ImplNumericGetValue( const OUString& rStr, BigInt& rValue, } } } - if ( !bNegative && bCurrency && !aStr.isEmpty() ) - { - sal_uInt16 nFormat = rLocaleDataWrapper.getCurrNegativeFormat(); - if ( (nFormat == 3) || (nFormat == 6) || - (nFormat == 7) || (nFormat == 10) ) - { - for (sal_Int32 i = aStr.getLength()-1; i > 0; i++ ) - { - if ( (aStr[ i ] >= '0') && (aStr[ i ] <= '9') ) - break; - else if ( aStr[ i ] == '-' ) - { - bNegative = true; - break; - } - } - } - } - } - else - { - if ( aStr1[ 0 ] == '-' ) - bNegative = true; } // delete unwanted characters @@ -223,7 +214,7 @@ bool ImplNumericGetValue( const OUString& rStr, BigInt& rValue, inline bool ImplLongCurrencyGetValue( const OUString& rStr, BigInt& rValue, sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper ) { - return ImplNumericGetValue( rStr, rValue, nDecDigits, rLocaleDataWrapper, true ); + return ImplCurrencyGetValue( rStr, rValue, nDecDigits, rLocaleDataWrapper ); } bool ImplLongCurrencyReformat( const OUString& rStr, BigInt const & nMin, BigInt const & nMax, @@ -232,7 +223,7 @@ bool ImplLongCurrencyReformat( const OUString& rStr, BigInt const & nMin, BigInt LongCurrencyFormatter const & rFormatter ) { BigInt nValue; - if ( !ImplNumericGetValue( rStr, nValue, nDecDigits, rLocaleDataWrapper, true ) ) + if ( !ImplCurrencyGetValue( rStr, nValue, nDecDigits, rLocaleDataWrapper ) ) return true; else { diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx index 6eac7de94e56..f9306c864249 100644 --- a/vcl/source/window/menuitemlist.cxx +++ b/vcl/source/window/menuitemlist.cxx @@ -53,7 +53,7 @@ MenuItemData* MenuItemList::Insert( const OString &rIdent ) { - MenuItemData* pData = new MenuItemData( rStr, Image() ); + MenuItemData* pData = new MenuItemData( rStr ); pData->nId = nId; pData->sIdent = rIdent; pData->eType = eType; diff --git a/vcl/source/window/menuitemlist.hxx b/vcl/source/window/menuitemlist.hxx index 2b086af41212..300908eee447 100644 --- a/vcl/source/window/menuitemlist.hxx +++ b/vcl/source/window/menuitemlist.hxx @@ -71,7 +71,7 @@ struct MenuItemData , pSalMenuItem(nullptr) { } - MenuItemData( const OUString& rStr, const Image& rImage ) + MenuItemData( const OUString& rStr ) : nId(0) , eType(MenuItemType::DONTKNOW) , nBits(MenuItemBits::NONE) @@ -79,7 +79,7 @@ struct MenuItemData , aText(rStr) , nUserValue(nullptr) , aUserValueReleaseFunc(nullptr) - , aImage(rImage) + , aImage() , bChecked(false) , bEnabled(false) , bVisible(false) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index a90b1d4814e4..9ff745b27dcb 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -4875,9 +4875,9 @@ static bool ImplIsValidItem( const ImplToolItem* pItem, bool bNotClipped ) return bValid; } -bool ToolBox::ChangeHighlightUpDn( bool bUp, bool bNoCyle ) +bool ToolBox::ChangeHighlightUpDn( bool bUp ) { - return ImplChangeHighlightUpDn(bUp, bNoCyle); + return ImplChangeHighlightUpDn(bUp, /*bNoCyle*/ false); } bool ToolBox::ImplChangeHighlightUpDn( bool bUp, bool bNoCycle ) |