i18nlangtag/source/languagetag/languagetag.cxx | 4 +-- include/i18nlangtag/languagetag.hxx | 9 ++----- include/vcl/TaskStopwatch.hxx | 9 +++---- include/vcl/menu.hxx | 2 - sfx2/source/dialog/StyleList.cxx | 2 - sfx2/source/dialog/templdlg.cxx | 11 +++------ sfx2/source/inc/templdgi.hxx | 2 - starmath/inc/edit.hxx | 2 - starmath/source/dialog.cxx | 4 +-- starmath/source/edit.cxx | 4 +-- svl/source/misc/adrparse.cxx | 30 +++++-------------------- svl/source/numbers/numfmuno.cxx | 2 - sw/source/uibase/docvw/romenu.cxx | 2 - sw/source/uibase/lingu/olmenu.cxx | 4 +-- unotools/source/i18n/localedatawrapper.cxx | 29 ++++++++++-------------- vcl/source/window/menu.cxx | 4 +-- 16 files changed, 47 insertions(+), 73 deletions(-)
New commits: commit ceb8f5d62c7afc5547c9a6de8eb570a11b5fbd67 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Mar 24 08:54:35 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Mar 24 15:06:24 2022 +0100 loplugin:constantparam Change-Id: I86592be0717c062a918108bf4437074b0f70b372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 29c85cd710fc..f61ccc8ec235 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -2828,9 +2828,9 @@ css::lang::Locale LanguageTag::convertToLocaleWithFallback( const OUString& rBcp // static -LanguageType LanguageTag::convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale, bool bResolveSystem ) +LanguageType LanguageTag::convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale ) { - if (rLocale.Language.isEmpty() && !bResolveSystem) + if (rLocale.Language.isEmpty()) return LANGUAGE_SYSTEM; return LanguageTag( rLocale).makeFallback().getLanguageType(); diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx index 500f84da00f7..3b5fb3d6d445 100644 --- a/include/i18nlangtag/languagetag.hxx +++ b/include/i18nlangtag/languagetag.hxx @@ -510,13 +510,10 @@ public: /** Convert Locale to MS-LangID with fallback. - @param bResolveSystem - If TRUE, resolve an empty language tag denoting the system - locale to the real locale used and fallback. - If FALSE, return LANGUAGE_SYSTEM for such a tag and do not fallback. + Resolves an empty language tag denoting the system + locale to LANGUAGE_SYSTEM and does not fallback. */ - static LanguageType convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale, - bool bResolveSystem = true ); + static LanguageType convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale ); /** If rString represents a valid BCP 47 language tag. diff --git a/include/vcl/TaskStopwatch.hxx b/include/vcl/TaskStopwatch.hxx index 1ca2c21a7e46..b27b3a316abe 100644 --- a/include/vcl/TaskStopwatch.hxx +++ b/include/vcl/TaskStopwatch.hxx @@ -39,14 +39,14 @@ class VCL_DLLPUBLIC TaskStopwatch bool m_bConsiderLastIterTime; VclInputFlags m_eInputStop; - bool nextIter(bool bQueryOnly) + bool nextIter() { sal_uInt64 nCurTicks = tools::Time::GetSystemTicks(); // handle system ticks wrap as exceeded time slice if (nCurTicks < m_nStartTicks) return false; - if (!bQueryOnly && m_bConsiderLastIterTime) + if (m_bConsiderLastIterTime) { // based on the last iter runtime, we don't expect to finish in time // m_nTimeSlice < (nCurTicks - m_nStartTicks) + (nCurTicks - m_nIterStartTicks) @@ -57,8 +57,7 @@ class VCL_DLLPUBLIC TaskStopwatch else if (m_nTimeSlice < nCurTicks - m_nStartTicks) return false; - if (!bQueryOnly) - m_nIterStartTicks = nCurTicks; + m_nIterStartTicks = nCurTicks; return !Application::AnyInput(m_eInputStop); } @@ -84,7 +83,7 @@ public: /** * Returns true, if another iteration will probably pass in the time slot **/ - bool continueIter() { return nextIter(false); } + bool continueIter() { return nextIter(); } /** * Reset the stopwatch diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index a6699a7e71d9..54df7ee66631 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -289,7 +289,7 @@ public: bool IsMenuVisible() const; virtual bool IsMenuBar() const = 0; - void RemoveDisabledEntries( bool bCheckPopups = true, bool bRemoveEmptyPopups = false ); + void RemoveDisabledEntries( bool bRemoveEmptyPopups = false ); void UpdateNativeMenu(); diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index cc9f94168a93..6f8e3543aac8 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -1699,7 +1699,7 @@ void StyleList::Update() // other DocShell -> all new m_pParentDialog->CheckItem(OString::number(m_nActFamily)); m_nActFilter = static_cast<sal_uInt16>(m_aLoadFactoryStyleFilter.Call(pDocShell)); - m_pParentDialog->IsUpdate(true, *this); + m_pParentDialog->IsUpdate(*this); if (0xffff == m_nActFilter) { m_nActFilter = pDocShell->GetAutoStyleFilterIndex(); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 0e1fe5b822cc..5c28cbc6bf66 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -494,17 +494,14 @@ void SfxCommonTemplateDialog_Impl::FilterSelect( m_aStyleList.FilterSelect(nActFilter, true); } -void SfxCommonTemplateDialog_Impl::IsUpdate(bool bDoUpdate, StyleList&) +void SfxCommonTemplateDialog_Impl::IsUpdate(StyleList&) { SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); SfxObjectShell* pDocShell = pViewFrame->GetObjectShell(); - if (bDoUpdate) + nActFilter = static_cast<sal_uInt16>(LoadFactoryStyleFilter_Hdl(pDocShell)); + if (0xffff == nActFilter) { - nActFilter = static_cast<sal_uInt16>(LoadFactoryStyleFilter_Hdl(pDocShell)); - if (0xffff == nActFilter) - { - nActFilter = pDocShell->GetAutoStyleFilterIndex(); - } + nActFilter = pDocShell->GetAutoStyleFilterIndex(); } } diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index a5333d395b7f..6c72de1ca8e4 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -172,7 +172,7 @@ public: void SelectStyle(const OUString& rStyle, bool bIsCallback, StyleList& rStyleList); //When a new document is created, it comes into action - void IsUpdate(bool bDoUpdate, StyleList&); + void IsUpdate(StyleList&); // This function return the value of bUpdate in Stylelist // This value is used in StyleList's Notify diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 503cdd8452a9..2fd6fac636b4 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -112,7 +112,7 @@ public: ESelection GetSelection() const; void SetSelection(const ESelection& rSel); - void UpdateStatus(bool bSetDocModified); + void UpdateStatus(); bool IsEmpty() const; bool IsSelected() const; diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 66f42f6c662f..b3dc324a0d5f 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -181,7 +181,7 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::Dialo SmPrintOptionsTabPage::~SmPrintOptionsTabPage() { - SmGetActiveView()->GetEditWindow()->UpdateStatus(false); + SmGetActiveView()->GetEditWindow()->UpdateStatus(); } bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) @@ -204,7 +204,7 @@ bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) rSet->Put(SfxBoolItem(SID_AUTO_CLOSE_BRACKETS, m_xAutoCloseBrackets->get_active())); rSet->Put(SfxUInt16Item(SID_SMEDITWINDOWZOOM, sal::static_int_cast<sal_uInt16>(m_xSmZoom->get_value(FieldUnit::PERCENT)))); - SmGetActiveView()->GetEditWindow()->UpdateStatus(false); + SmGetActiveView()->GetEditWindow()->UpdateStatus(); return true; } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 6b192a930d97..2440a92be948 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -715,9 +715,9 @@ void SmEditTextWindow::UpdateStatus(bool bSetDocModified) static_cast<SmEditEngine*>(GetEditEngine())->executeZoom(GetEditView()); } -void SmEditWindow::UpdateStatus(bool bSetDocModified) +void SmEditWindow::UpdateStatus() { - mxTextControl->UpdateStatus(bSetDocModified); + mxTextControl->UpdateStatus(/*bSetDocModified*/false); } void SmEditWindow::Cut() diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx index a0cdcfdfc022..19e869a09289 100644 --- a/svl/source/misc/adrparse.cxx +++ b/svl/source/misc/adrparse.cxx @@ -88,7 +88,7 @@ class SvAddressParser_Impl bool readToken(); static OUString reparse(sal_Unicode const * pBegin, - sal_Unicode const * pEnd, bool bAddrSpec); + sal_Unicode const * pEnd); public: SvAddressParser_Impl(SvAddressParser * pParser, const OUString& rIn); @@ -245,12 +245,11 @@ bool SvAddressParser_Impl::readToken() // static OUString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, - sal_Unicode const * pEnd, bool bAddrSpec) + sal_Unicode const * pEnd) { OUStringBuffer aResult; TokenType eMode = TOKEN_ATOM; bool bEscaped = false; - bool bEndsWithSpace = false; int nLevel = 0; while (pBegin < pEnd) { @@ -265,14 +264,12 @@ OUString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, } else if (cChar == '"') { - if (bAddrSpec) - aResult.append(cChar); + aResult.append(cChar); eMode = TOKEN_ATOM; } else if (cChar == '\\') { - if (bAddrSpec) - aResult.append(cChar); + aResult.append(cChar); bEscaped = true; } else @@ -292,8 +289,7 @@ OUString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, } else if (cChar == '\\') { - if (bAddrSpec) - aResult.append(cChar); + aResult.append(cChar); bEscaped = true; } else @@ -317,28 +313,16 @@ OUString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, case TOKEN_ATOM: if (cChar <= ' ' || cChar == 0x7F) // DEL { - if (!bAddrSpec && !bEndsWithSpace) - { - aResult.append(' '); - bEndsWithSpace = true; - } } else if (cChar == '(') { - if (!bAddrSpec && !bEndsWithSpace) - { - aResult.append(' '); - bEndsWithSpace = true; - } eMode = TOKEN_COMMENT; } else { - bEndsWithSpace = false; if (cChar == '"') { - if (bAddrSpec) - aResult.append(cChar); + aResult.append(cChar); eMode = TOKEN_QUOTED; } else if (cChar == '[') @@ -502,7 +486,7 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, { OUString aTheAddrSpec; if (m_pAddrSpec->m_bReparse) - aTheAddrSpec = reparse(m_pAddrSpec->m_pBegin, m_pAddrSpec->m_pEnd, true); + aTheAddrSpec = reparse(m_pAddrSpec->m_pBegin, m_pAddrSpec->m_pEnd); else { sal_Int32 nLen = m_pAddrSpec->m_pEnd - m_pAddrSpec->m_pBegin; diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 84812f9c5eef..a17a71a81947 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -97,7 +97,7 @@ static const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap() static LanguageType lcl_GetLanguage( const lang::Locale& rLocale ) { - LanguageType eRet = LanguageTag::convertToLanguageTypeWithFallback( rLocale, false); + LanguageType eRet = LanguageTag::convertToLanguageTypeWithFallback( rLocale ); if ( eRet == LANGUAGE_NONE ) eRet = LANGUAGE_SYSTEM; //! or throw an exception? diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index a252c16b0140..a9319e70d158 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -217,7 +217,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) } Check(m_nReadonlyFullscreen, SID_WIN_FULLSCREEN, rDis); - m_xMenu->RemoveDisabledEntries( true, true ); + m_xMenu->RemoveDisabledEntries( true ); } void SwReadOnlyPopup::Execute( vcl::Window* pWin, const Point &rPixPos ) diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index a145c2a54878..68855b28f1b5 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -398,7 +398,7 @@ SwSpellPopup::SwSpellPopup( vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame)); checkRedline(); - m_xPopupMenu->RemoveDisabledEntries( true, true ); + m_xPopupMenu->RemoveDisabledEntries( true ); InitItemCommands(aSuggestions); } @@ -555,7 +555,7 @@ SwSpellPopup::SwSpellPopup( vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame)); checkRedline(); - m_xPopupMenu->RemoveDisabledEntries(true, true); + m_xPopupMenu->RemoveDisabledEntries(true); SvtLinguConfig().SetProperty( UPN_IS_GRAMMAR_INTERACTIVE, uno::makeAny( true )); diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 96ad86d4b76a..904808c6a247 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -972,16 +972,13 @@ static void ImplAddNum( OUStringBuffer& rBuf, sal_Int64 nNumber, int nMinLen ) return ImplAddUNum( rBuf, nNumber, nMinLen); } -static void ImplAdd2UNum( OUStringBuffer& rBuf, sal_uInt16 nNumber, bool bLeading ) +static void ImplAdd2UNum( OUStringBuffer& rBuf, sal_uInt16 nNumber ) { DBG_ASSERT( nNumber < 100, "ImplAdd2UNum() - Number >= 100" ); if ( nNumber < 10 ) { - if ( bLeading ) - { - rBuf.append('0'); - } + rBuf.append('0'); rBuf.append(static_cast<char>(nNumber + '0')); } else @@ -1124,25 +1121,25 @@ OUString LocaleDataWrapper::getDate( const Date& rDate ) const switch ( getDateOrder() ) { case DateOrder::DMY : - ImplAdd2UNum( aBuf, nDay, true /* IsDateDayLeadingZero() */ ); + ImplAdd2UNum( aBuf, nDay ); aBuf.append( aLocaleDataItem.dateSeparator ); - ImplAdd2UNum( aBuf, nMonth, true /* IsDateMonthLeadingZero() */ ); + ImplAdd2UNum( aBuf, nMonth ); aBuf.append( aLocaleDataItem.dateSeparator ); ImplAddNum( aBuf, nYear, nYearLen ); break; case DateOrder::MDY : - ImplAdd2UNum( aBuf, nMonth, true /* IsDateMonthLeadingZero() */ ); + ImplAdd2UNum( aBuf, nMonth ); aBuf.append( aLocaleDataItem.dateSeparator ); - ImplAdd2UNum( aBuf, nDay, true /* IsDateDayLeadingZero() */ ); + ImplAdd2UNum( aBuf, nDay ); aBuf.append( aLocaleDataItem.dateSeparator ); ImplAddNum( aBuf, nYear, nYearLen ); break; default: ImplAddNum( aBuf, nYear, nYearLen ); aBuf.append( aLocaleDataItem.dateSeparator ); - ImplAdd2UNum( aBuf, nMonth, true /* IsDateMonthLeadingZero() */ ); + ImplAdd2UNum( aBuf, nMonth ); aBuf.append( aLocaleDataItem.dateSeparator ); - ImplAdd2UNum( aBuf, nDay, true /* IsDateDayLeadingZero() */ ); + ImplAdd2UNum( aBuf, nDay ); } return aBuf.makeStringAndClear(); @@ -1156,13 +1153,13 @@ OUString LocaleDataWrapper::getTime( const tools::Time& rTime, bool bSec, bool b nHour %= 24; - ImplAdd2UNum( aBuf, nHour, true /* IsTimeLeadingZero() */ ); + ImplAdd2UNum( aBuf, nHour ); aBuf.append( aLocaleDataItem.timeSeparator ); - ImplAdd2UNum( aBuf, rTime.GetMin(), true ); + ImplAdd2UNum( aBuf, rTime.GetMin() ); if ( bSec ) { aBuf.append( aLocaleDataItem.timeSeparator ); - ImplAdd2UNum( aBuf, rTime.GetSec(), true ); + ImplAdd2UNum( aBuf, rTime.GetSec() ); if ( b100Sec ) { @@ -1186,11 +1183,11 @@ OUString LocaleDataWrapper::getDuration( const tools::Time& rTime, bool bSec, bo else ImplAddUNum( aBuf, rTime.GetHour() ); aBuf.append( aLocaleDataItem.timeSeparator ); - ImplAdd2UNum( aBuf, rTime.GetMin(), true ); + ImplAdd2UNum( aBuf, rTime.GetMin() ); if ( bSec ) { aBuf.append( aLocaleDataItem.timeSeparator ); - ImplAdd2UNum( aBuf, rTime.GetSec(), true ); + ImplAdd2UNum( aBuf, rTime.GetSec() ); if ( b100Sec ) { diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index e06438828016..4220fa533a3e 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2139,7 +2139,7 @@ Menu* Menu::ImplFindMenu( sal_uInt16 nItemId ) return pSelMenu; } -void Menu::RemoveDisabledEntries( bool bCheckPopups, bool bRemoveEmptyPopups ) +void Menu::RemoveDisabledEntries( bool bRemoveEmptyPopups ) { for ( sal_uInt16 n = 0; n < GetItemCount(); n++ ) { @@ -2153,7 +2153,7 @@ void Menu::RemoveDisabledEntries( bool bCheckPopups, bool bRemoveEmptyPopups ) else bRemove = !pItem->bEnabled; - if ( bCheckPopups && pItem->pSubMenu ) + if ( pItem->pSubMenu ) { pItem->pSubMenu->RemoveDisabledEntries(); if ( bRemoveEmptyPopups && !pItem->pSubMenu->GetItemCount() )