24 : m_pField(
std::move(pControl))
29 , m_nOldDigits(m_pField->get_digits())
31 , m_bLockAutoCalculation(false)
34 m_pField->get_range(nMin, nMax, FieldUnit::TWIP);
51 if ((bPercent &&
m_pField->get_unit() == FieldUnit::PERCENT)
52 || (!bPercent &&
m_pField->get_unit() != FieldUnit::PERCENT))
65 m_pField->set_unit(FieldUnit::PERCENT);
68 sal_Int64 nCurrentWidth
73 m_pField->set_range(std::max(1, nPercent), 100, FieldUnit::NONE);
74 m_pField->set_increments(5, 10, FieldUnit::NONE);
80 m_pField->set_value(nPercent, FieldUnit::NONE);
89 sal_Int64 nOldPercent =
get_value(FieldUnit::PERCENT);
111 if (
m_pField->get_unit() != FieldUnit::PERCENT || eInUnit == FieldUnit::PERCENT)
116 sal_Int64 nPercent, nCurrentWidth;
117 if (eInUnit == FieldUnit::TWIP)
128 m_pField->set_value(nPercent, FieldUnit::NONE);
139 if (
m_pField->get_unit() != FieldUnit::PERCENT)
140 m_pField->set_min(nNewMin, eInUnit);
143 if (eInUnit == FieldUnit::NONE)
147 int nPercent =
Convert(nNewMin, eInUnit, FieldUnit::PERCENT);
148 m_pField->set_min(std::max(1, nPercent), FieldUnit::NONE);
154 if (
m_pField->get_unit() != FieldUnit::PERCENT)
155 m_pField->set_max(nNewMax, eInUnit);
160 if (
m_pField->get_unit() != FieldUnit::PERCENT)
169 if (
m_pField->get_unit() != FieldUnit::PERCENT)
183 for (sal_uInt16
i = 0;
i <
n; ++
i)
191 if (
m_pField->get_unit() != FieldUnit::PERCENT)
199 if (eInUnit == eOutUnit || (eInUnit == FieldUnit::NONE && eOutUnit ==
m_pField->get_unit())
200 || (eOutUnit == FieldUnit::NONE && eInUnit ==
m_pField->get_unit()))
203 if (eInUnit == FieldUnit::PERCENT)
208 if (eOutUnit == FieldUnit::TWIP)
215 if (eOutUnit == FieldUnit::PERCENT)
218 sal_Int64 nCurrentWidth;
221 if (eInUnit == FieldUnit::TWIP)
SwPercentField(std::unique_ptr< weld::MetricSpinButton > pControl)
void SetRefValue(sal_Int64 nValue)
void ShowPercent(bool bPercent)
void set_value(sal_Int64 nNewValue, FieldUnit eInUnit=FieldUnit::NONE)
sal_Int64 DenormalizePercent(sal_Int64 nValue)
sal_Int64 NormalizePercent(sal_Int64 nValue)
static SAL_DLLPRIVATE int ImpPower10(sal_uInt16 n)
sal_Int64 GetRealValue(FieldUnit eOutUnit)
std::unique_ptr< weld::MetricSpinButton > m_pField
sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
void set_max(sal_Int64 nNewMax, FieldUnit eInUnit)
void set_min(sal_Int64 nNewMin, FieldUnit eInUnit)
bool m_bLockAutoCalculation
sal_Int64 get_value(FieldUnit eOutUnit=FieldUnit::NONE)
sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)