include/svtools/ctrlbox.hxx | 58 +++++++------- svtools/source/control/ctrlbox.cxx | 150 ++++++++++++++++++------------------- 2 files changed, 106 insertions(+), 102 deletions(-)
New commits: commit ec5025d637b735ddbbb8d0e5cc72ee1e8a76430b Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 4 15:48:13 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 4 21:45:35 2026 +0100 svtools: Prefix FontSizeBox members with "m_" Change-Id: Icea9624bd784893a2bd9f582e8787a5401039c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198694 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index d80d61b8564b..983276646066 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -427,31 +427,35 @@ private: class SVT_DLLPUBLIC FontSizeBox { - const FontList* pFontList; - int nSavedValue; - int nMin; - int nMax; - FieldUnit eUnit; - sal_uInt16 nDecimalDigits; - sal_uInt16 nRelMin; - sal_uInt16 nRelMax; - sal_uInt16 nRelStep; - short nPtRelMin; - short nPtRelMax; - short nPtRelStep; - bool bRelativeMode:1, - bRelative:1, - bPtRelative:1, - bStdSize:1; + const FontList* m_pFontList; + int m_nSavedValue; + int m_nMin; + int m_nMax; + FieldUnit m_eUnit; + sal_uInt16 m_nDecimalDigits; + sal_uInt16 m_nRelMin; + sal_uInt16 m_nRelMax; + sal_uInt16 m_nRelStep; + short m_nPtRelMin; + short m_nPtRelMax; + short m_nPtRelStep; + bool m_bRelativeMode : 1; + bool m_bRelative : 1; + bool m_bPtRelative : 1; + bool m_bStdSize : 1; Link<weld::ComboBox&, void> m_aChangeHdl; Link<weld::Widget&, void> m_aFocusOutHdl; std::unique_ptr<weld::ComboBox> m_xComboBox; - sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; } - void SetDecimalDigits(sal_uInt16 nDigits) { nDecimalDigits = nDigits; } - FieldUnit GetUnit() const { return eUnit; } - void SetUnit(FieldUnit _eUnit) { eUnit = _eUnit; } - void SetRange(int nNewMin, int nNewMax) { nMin = nNewMin; nMax = nNewMax; } + sal_uInt16 GetDecimalDigits() const { return m_nDecimalDigits; } + void SetDecimalDigits(sal_uInt16 nDigits) { m_nDecimalDigits = nDigits; } + FieldUnit GetUnit() const { return m_eUnit; } + void SetUnit(FieldUnit _eUnit) { m_eUnit = _eUnit; } + void SetRange(int nNewMin, int nNewMax) + { + m_nMin = nNewMin; + m_nMax = nNewMax; + } void SetValue(int nNewValue, FieldUnit eInUnit); void InsertValue(int i); @@ -467,15 +471,15 @@ public: void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep = 5); void EnablePtRelativeMode(short nMin, short nMax, short nStep = 10); - bool IsRelativeMode() const { return bRelativeMode; } + bool IsRelativeMode() const { return m_bRelativeMode; } void SetRelative( bool bRelative ); - bool IsRelative() const { return bRelative; } + bool IsRelative() const { return m_bRelative; } void SetPtRelative( bool bPtRel ) { - bPtRelative = bPtRel; + m_bPtRelative = bPtRel; SetRelative(true); } - bool IsPtRelative() const { return bPtRelative; } + bool IsPtRelative() const { return m_bPtRelative; } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; } @@ -488,8 +492,8 @@ public: int get_active() const { return m_xComboBox->get_active(); } int get_value() const; void set_value(int nValue); - void save_value() { nSavedValue = get_value(); } - int get_saved_value() const { return nSavedValue; } + void save_value() { m_nSavedValue = get_value(); } + int get_saved_value() const { return m_nSavedValue; } bool get_value_changed_from_saved() const { return get_value() != get_saved_value(); } int get_count() const { return m_xComboBox->get_count(); } OUString get_text(int i) const { return m_xComboBox->get_text(i); } diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index eb5972c405a2..0d6a484fb950 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1095,22 +1095,22 @@ void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) } FontSizeBox::FontSizeBox(std::unique_ptr<weld::ComboBox> p) - : pFontList(nullptr) - , nSavedValue(0) - , nMin(20) - , nMax(9999) - , eUnit(FieldUnit::POINT) - , nDecimalDigits(1) - , nRelMin(0) - , nRelMax(0) - , nRelStep(0) - , nPtRelMin(0) - , nPtRelMax(0) - , nPtRelStep(0) - , bRelativeMode(false) - , bRelative(false) - , bPtRelative(false) - , bStdSize(false) + : m_pFontList(nullptr) + , m_nSavedValue(0) + , m_nMin(20) + , m_nMax(9999) + , m_eUnit(FieldUnit::POINT) + , m_nDecimalDigits(1) + , m_nRelMin(0) + , m_nRelMax(0) + , m_nRelStep(0) + , m_nPtRelMin(0) + , m_nPtRelMax(0) + , m_nPtRelStep(0) + , m_bRelativeMode(false) + , m_bRelative(false) + , m_bPtRelative(false) + , m_bStdSize(false) , m_xComboBox(std::move(p)) { m_xComboBox->set_entry_width_chars(std::ceil(m_xComboBox->get_pixel_size(format_number(105)).Width() / @@ -1130,7 +1130,7 @@ void FontSizeBox::set_active_or_entry_text(const OUString& rText) IMPL_LINK(FontSizeBox, ReformatHdl, weld::Widget&, rWidget, void) { FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType()); - if (!bRelativeMode || !aFontSizeNames.IsEmpty()) + if (!m_bRelativeMode || !aFontSizeNames.IsEmpty()) { if (aFontSizeNames.Name2Size(m_xComboBox->get_active_text()) != 0) return; @@ -1143,24 +1143,24 @@ IMPL_LINK(FontSizeBox, ReformatHdl, weld::Widget&, rWidget, void) IMPL_LINK(FontSizeBox, ModifyHdl, weld::ComboBox&, rBox, void) { - if (bRelativeMode) + if (m_bRelativeMode) { OUString aStr = comphelper::string::stripStart(rBox.get_active_text(), ' '); - bool bNewMode = bRelative; - bool bOldPtRelMode = bPtRelative; + bool bNewMode = m_bRelative; + bool bOldPtRelMode = m_bPtRelative; - if ( bRelative ) + if (m_bRelative) { - bPtRelative = false; + m_bPtRelative = false; const sal_Unicode* pStr = aStr.getStr(); while ( *pStr ) { if ( ((*pStr < '0') || (*pStr > '9')) && (*pStr != '%') && !unicode::isSpace(*pStr) ) { - if ( ('-' == *pStr || '+' == *pStr) && !bPtRelative ) - bPtRelative = true; - else if ( bPtRelative && 'p' == *pStr && 't' == *++pStr ) + if (('-' == *pStr || '+' == *pStr) && !m_bPtRelative) + m_bPtRelative = true; + else if (m_bPtRelative && 'p' == *pStr && 't' == *++pStr) ; else { @@ -1176,17 +1176,17 @@ IMPL_LINK(FontSizeBox, ModifyHdl, weld::ComboBox&, rBox, void) if ( -1 != aStr.indexOf('%') ) { bNewMode = true; - bPtRelative = false; + m_bPtRelative = false; } if ( '-' == aStr[0] || '+' == aStr[0] ) { bNewMode = true; - bPtRelative = true; + m_bPtRelative = true; } } - if ( bNewMode != bRelative || bPtRelative != bOldPtRelMode ) + if (bNewMode != m_bRelative || m_bPtRelative != bOldPtRelMode) SetRelative( bNewMode ); } m_aChangeHdl.Call(rBox); @@ -1195,10 +1195,10 @@ IMPL_LINK(FontSizeBox, ModifyHdl, weld::ComboBox&, rBox, void) void FontSizeBox::Fill( const FontList* pList ) { // remember for relative mode - pFontList = pList; + m_pFontList = pList; // no font sizes need to be set for relative mode - if ( bRelative ) + if (m_bRelative) return; // query font sizes @@ -1212,12 +1212,12 @@ void FontSizeBox::Fill( const FontList* pList ) if ( pAry == FontList::GetStdSizeAry() ) { // for standard sizes we don't need to bother - if (bStdSize && m_xComboBox->get_count() && aFontSizeNames.IsEmpty()) + if (m_bStdSize && m_xComboBox->get_count() && aFontSizeNames.IsEmpty()) return; - bStdSize = true; + m_bStdSize = true; } else - bStdSize = false; + m_bStdSize = false; int nSelectionStart, nSelectionEnd; m_xComboBox->get_entry_selection_bounds(nSelectionStart, nSelectionEnd); @@ -1275,19 +1275,19 @@ void FontSizeBox::Fill( const FontList* pList ) void FontSizeBox::EnableRelativeMode( sal_uInt16 nNewMin, sal_uInt16 nNewMax, sal_uInt16 nStep ) { - bRelativeMode = true; - nRelMin = nNewMin; - nRelMax = nNewMax; - nRelStep = nStep; + m_bRelativeMode = true; + m_nRelMin = nNewMin; + m_nRelMax = nNewMax; + m_nRelStep = nStep; SetUnit(FieldUnit::POINT); } void FontSizeBox::EnablePtRelativeMode( short nNewMin, short nNewMax, short nStep ) { - bRelativeMode = true; - nPtRelMin = nNewMin; - nPtRelMax = nNewMax; - nPtRelStep = nStep; + m_bRelativeMode = true; + m_nPtRelMin = nNewMin; + m_nPtRelMax = nNewMax; + m_nPtRelStep = nStep; SetUnit(FieldUnit::POINT); } @@ -1299,7 +1299,7 @@ void FontSizeBox::InsertValue(int i) void FontSizeBox::SetRelative( bool bNewRelative ) { - if ( !bRelativeMode ) + if (!m_bRelativeMode) return; int nSelectionStart, nSelectionEnd; @@ -1308,49 +1308,49 @@ void FontSizeBox::SetRelative( bool bNewRelative ) if (bNewRelative) { - bRelative = true; - bStdSize = false; + m_bRelative = true; + m_bStdSize = false; m_xComboBox->clear(); - if (bPtRelative) + if (m_bPtRelative) { SetDecimalDigits( 1 ); - SetRange(nPtRelMin, nPtRelMax); + SetRange(m_nPtRelMin, m_nPtRelMax); SetUnit(FieldUnit::POINT); - short i = nPtRelMin, n = 0; + short i = m_nPtRelMin, n = 0; // JP 30.06.98: more than 100 values are not useful - while ( i <= nPtRelMax && n++ < 100 ) + while (i <= m_nPtRelMax && n++ < 100) { InsertValue( i ); - i = i + nPtRelStep; + i = i + m_nPtRelStep; } } else { SetDecimalDigits(0); - SetRange(nRelMin, nRelMax); + SetRange(m_nRelMin, m_nRelMax); SetUnit(FieldUnit::PERCENT); - sal_uInt16 i = nRelMin; - while ( i <= nRelMax ) + sal_uInt16 i = m_nRelMin; + while (i <= m_nRelMax) { InsertValue( i ); - i = i + nRelStep; + i = i + m_nRelStep; } } } else { - if (pFontList) + if (m_pFontList) m_xComboBox->clear(); - bRelative = bPtRelative = false; + m_bRelative = m_bPtRelative = false; SetDecimalDigits(1); SetRange(20, 9999); SetUnit(FieldUnit::POINT); - if ( pFontList) - Fill( pFontList ); + if (m_pFontList) + Fill(m_pFontList); } set_active_or_entry_text(aStr); @@ -1362,24 +1362,24 @@ OUString FontSizeBox::format_number(int nValue) const OUString sRet; //pawn percent off to icu to decide whether percent is separated from its number for this locale - if (eUnit == FieldUnit::PERCENT) + if (m_eUnit == FieldUnit::PERCENT) { double fValue = nValue; - fValue /= weld::SpinButton::Power10(nDecimalDigits); + fValue /= weld::SpinButton::Power10(m_nDecimalDigits); sRet = unicode::formatPercent(fValue, Application::GetSettings().GetUILanguageTag()); } else { const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); - sRet = rLocaleData.getNum(nValue, nDecimalDigits, true, false); - if (eUnit != FieldUnit::NONE && eUnit != FieldUnit::DEGREE) + sRet = rLocaleData.getNum(nValue, m_nDecimalDigits, true, false); + if (m_eUnit != FieldUnit::NONE && m_eUnit != FieldUnit::DEGREE) sRet += " "; - assert(eUnit != FieldUnit::PERCENT); - sRet += weld::MetricSpinButton::MetricToString(eUnit); + assert(m_eUnit != FieldUnit::PERCENT); + sRet += weld::MetricSpinButton::MetricToString(m_eUnit); } - if (bRelativeMode && bPtRelative && (0 <= nValue) && !sRet.isEmpty()) + if (m_bRelativeMode && m_bPtRelative && (0 <= nValue) && !sRet.isEmpty()) sRet = "+" + sRet; return sRet; @@ -1388,11 +1388,11 @@ OUString FontSizeBox::format_number(int nValue) const void FontSizeBox::SetValue(int nNewValue, FieldUnit eInUnit) { auto nTempValue = vcl::ConvertValue(nNewValue, 0, GetDecimalDigits(), eInUnit, GetUnit()); - if (nTempValue < nMin) - nTempValue = nMin; - else if (nTempValue > nMax) - nTempValue = nMax; - if (!bRelative) + if (nTempValue < m_nMin) + nTempValue = m_nMin; + else if (nTempValue > m_nMax) + nTempValue = m_nMax; + if (!m_bRelative) { FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType()); // conversion loses precision; however font sizes should @@ -1410,13 +1410,13 @@ void FontSizeBox::SetValue(int nNewValue, FieldUnit eInUnit) void FontSizeBox::set_value(int nNewValue) { - SetValue(nNewValue, eUnit); + SetValue(nNewValue, m_eUnit); } int FontSizeBox::get_value() const { OUString aStr = m_xComboBox->get_active_text(); - if (!bRelative) + if (!m_bRelative) { FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType()); auto nValue = aFontSizeNames.Name2Size(aStr); @@ -1434,10 +1434,10 @@ int FontSizeBox::get_value() const (void)vcl::TextToValue(aStr, fResult, 0, GetDecimalDigits(), rLocaleData, GetUnit()); if (!aStr.isEmpty()) { - if (fResult < nMin) - fResult = nMin; - else if (fResult > nMax) - fResult = nMax; + if (fResult < m_nMin) + fResult = m_nMin; + else if (fResult > m_nMax) + fResult = m_nMax; } return std::round(fResult); }
