diff options
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/transfrm.cxx | 10 | ||||
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 26 | ||||
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.hxx | 4 | ||||
-rw-r--r-- | include/svtools/unitconv.hxx | 4 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 64 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/mtrindlg.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/unitconv.cxx | 16 | ||||
-rw-r--r-- | svx/source/dialog/optgrid.cxx | 8 | ||||
-rw-r--r-- | svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/inc/prcntfld.hxx | 38 | ||||
-rw-r--r-- | sw/source/uibase/table/tablepg.hxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/utlui/prcntfld.cxx | 37 | ||||
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 12 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 14 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 22 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 12 |
20 files changed, 146 insertions, 149 deletions
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 5614c765ff7b..c28743eab125 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1617,7 +1617,7 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void) if(nActNumLvl & nMask) { SvxNumberFormat aNumFmt(pActNum->GetLevel(e)); - aNumFmt.SetIncludeUpperLevels(static_cast<sal_uInt8>(std::min(rBox.get_value(), int(e + 1))) ); + aNumFmt.SetIncludeUpperLevels(static_cast<sal_uInt8>(std::min(rBox.get_value(), sal_Int64(e + 1))) ); // Set the same prefix/suffix to generate list format with changed IncludedUpperLevels aNumFmt.SetListFormat(aNumFmt.GetPrefix(), aNumFmt.GetSuffix(), e); pActNum->SetLevel(e, aNumFmt); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 04335500ea58..8ebe0af11597 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -1044,7 +1044,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), mePoolUnit, MapUnit::Map100thMM)) / fUIScale); if (m_xMtrWidth->get_digits()) fTmpWidth *= pow(10.0, m_xMtrWidth->get_digits()); - m_xMtrWidth->set_value(static_cast<int>(fTmpWidth), FieldUnit::MM_100TH); + m_xMtrWidth->set_value(fTmpWidth, FieldUnit::MM_100TH); } { // #i75273# set height @@ -1053,7 +1053,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), mePoolUnit, MapUnit::Map100thMM)) / fUIScale); if (m_xMtrHeight->get_digits()) fTmpHeight *= pow(10.0, m_xMtrHeight->get_digits()); - m_xMtrHeight->set_value(static_cast<int>(fTmpHeight), FieldUnit::MM_100TH); + m_xMtrHeight->set_value(fTmpHeight, FieldUnit::MM_100TH); } pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE ); @@ -1271,7 +1271,7 @@ void SvxPositionSizeTabPage::SetMinMaxPosition() } } - const double fMaxLong(static_cast<double>(vcl::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); + const double fMaxLong(vcl::ConvertValue(std::numeric_limits<sal_Int64>::max(), 0, MapUnit::Map100thMM, meDlgUnit) - 1); fLeft = std::clamp(fLeft, -fMaxLong, fMaxLong); fRight = std::clamp(fRight, -fMaxLong, fMaxLong); fTop = std::clamp(fTop, - fMaxLong, fMaxLong); @@ -1503,7 +1503,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeWidthHdl, weld::MetricSpinButton&, return; sal_Int64 nHeight(basegfx::fround64((mfOldHeight * static_cast<double>(m_xMtrWidth->get_value(FieldUnit::NONE))) / mfOldWidth)); - int nMin, nMax; + sal_Int64 nMin, nMax; m_xMtrHeight->get_range(nMin, nMax, FieldUnit::NONE); if (nHeight <= nMax) @@ -1526,7 +1526,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeHeightHdl, weld::MetricSpinButton& return; sal_Int64 nWidth(basegfx::fround64((mfOldWidth * static_cast<double>(m_xMtrHeight->get_value(FieldUnit::NONE))) / mfOldHeight)); - int nMin, nMax; + sal_Int64 nMin, nMax; m_xMtrWidth->get_range(nMin, nMax, FieldUnit::NONE); if (nWidth <= nMax) diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 8c33d0598711..4aec523f9614 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -229,16 +229,16 @@ namespace pcr notifyModifiedValue(); } - static int ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) + static sal_Int64 ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) n *= 10; - return o3tl::saturating_cast<int>(n); + return o3tl::saturating_cast<sal_Int64>(n); } - static double ImplCalcDoubleValue( int nValue, sal_uInt16 nDigits ) + static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) @@ -376,7 +376,7 @@ namespace pcr void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits ) { weld::MetricSpinButton* pControlWindow = getTypedControlWindow(); - int min, max; + sal_Int64 min, max; pControlWindow->get_range(min, max, FieldUnit::NONE); pControlWindow->set_digits(decimaldigits); pControlWindow->set_range(min, max, FieldUnit::NONE); @@ -386,8 +386,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); - if ( minValue == std::numeric_limits<int>::min() ) + sal_Int64 minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); + if ( minValue == std::numeric_limits<sal_Int64>::min() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(minValue); @@ -398,7 +398,7 @@ namespace pcr void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) { if ( !_minvalue.IsPresent ) - getTypedControlWindow()->set_min( std::numeric_limits<int>::min(), FieldUnit::NONE ); + getTypedControlWindow()->set_min( std::numeric_limits<sal_Int64>::min(), FieldUnit::NONE ); else getTypedControlWindow()->set_min( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); } @@ -407,8 +407,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); - if ( maxValue == std::numeric_limits<int>::max() ) + sal_Int64 maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); + if ( maxValue == std::numeric_limits<sal_Int64>::max() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(maxValue); @@ -419,7 +419,7 @@ namespace pcr void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) { if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->set_max( std::numeric_limits<int>::max(), FieldUnit::NONE ); + getTypedControlWindow()->set_max( std::numeric_limits<sal_Int64>::max(), FieldUnit::NONE ); else getTypedControlWindow()->set_max( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); } @@ -478,14 +478,14 @@ namespace pcr } } - int ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const + sal_Int64 ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const { - int nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); + sal_Int64 nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); nControlValue /= m_nFieldToUNOValueFactor; return nControlValue; } - double ONumericControl::impl_fieldValueToApiValue_nothrow( int nFieldValue ) const + double ONumericControl::impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const { double nApiValue = ImplCalcDoubleValue( nFieldValue, getTypedControlWindow()->get_digits() ); nApiValue *= m_nFieldToUNOValueFactor; diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index 7a0c585b775c..fcd194886a1a 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -246,12 +246,12 @@ namespace pcr The conversion respects our decimal digits as well as our value factor (<member>m_nFieldToUNOValueFactor</member>). */ - int impl_apiValueToFieldValue_nothrow( double nApiValue ) const; + sal_Int64 impl_apiValueToFieldValue_nothrow( double nApiValue ) const; /** converts a control value, as obtained from our Numeric field, into a value which can passed to outer callers via our UNO API. */ - double impl_fieldValueToApiValue_nothrow( int nFieldValue ) const; + double impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const; }; //= OColorControl diff --git a/include/svtools/unitconv.hxx b/include/svtools/unitconv.hxx index 88bbffc146e5..ab9bdf50a914 100644 --- a/include/svtools/unitconv.hxx +++ b/include/svtools/unitconv.hxx @@ -43,8 +43,8 @@ SVT_DLLPUBLIC tools::Long ControlToItem( tools::Long nIn, FieldUnit eCtrl, SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const MapUnit eUnit ); -SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton& rField, int lCoreValue, MapUnit eUnit); -SVT_DLLPUBLIC int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit); +SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton& rField, sal_Int64 nCoreValue, MapUnit eUnit); +SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit); SVT_DLLPUBLIC tools::Long TransformMetric( tools::Long nVal, FieldUnit aOld, FieldUnit aNew ); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index af92c7640004..4190072690b7 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1716,31 +1716,31 @@ protected: } public: - virtual void set_value(int value) = 0; - virtual int get_value() const = 0; - virtual void set_range(int min, int max) = 0; - virtual void get_range(int& min, int& max) const = 0; - void set_min(int min) + virtual void set_value(sal_Int64 value) = 0; + virtual sal_Int64 get_value() const = 0; + virtual void set_range(sal_Int64 min, sal_Int64 max) = 0; + virtual void get_range(sal_Int64& min, sal_Int64& max) const = 0; + void set_min(sal_Int64 min) { - int dummy, max; + sal_Int64 dummy, max; get_range(dummy, max); set_range(min, max); } - void set_max(int max) + void set_max(sal_Int64 max) { - int min, dummy; + sal_Int64 min, dummy; get_range(min, dummy); set_range(min, max); } - int get_min() const + sal_Int64 get_min() const { - int min, dummy; + sal_Int64 min, dummy; get_range(min, dummy); return min; } - int get_max() const + sal_Int64 get_max() const { - int dummy, max; + sal_Int64 dummy, max; get_range(dummy, max); return max; } @@ -1754,9 +1754,9 @@ public: void connect_output(const Link<SpinButton&, void>& rLink) { m_aOutputHdl = rLink; } void connect_input(const Link<int*, bool>& rLink) { m_aInputHdl = rLink; } - int normalize(int nValue) const { return (nValue * Power10(get_digits())); } + sal_Int64 normalize(sal_Int64 nValue) const { return (nValue * Power10(get_digits())); } - int denormalize(int nValue) const; + sal_Int64 denormalize(sal_Int64 nValue) const; static unsigned int Power10(unsigned int n); }; @@ -1925,8 +1925,8 @@ class VCL_DLLPUBLIC MetricSpinButton final void signal_value_changed() { m_aValueChangedHdl.Call(*this); } - int ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const; - OUString format_number(int nValue) const; + sal_Int64 ConvertValue(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const; + OUString format_number(sal_Int64 nValue) const; void update_width_chars(); public: @@ -1948,22 +1948,22 @@ public: void set_unit(FieldUnit eUnit); - int convert_value_to(int nValue, FieldUnit eValueUnit) const + sal_Int64 convert_value_to(sal_Int64 nValue, FieldUnit eValueUnit) const { return ConvertValue(nValue, m_eSrcUnit, eValueUnit); } - int convert_value_from(int nValue, FieldUnit eValueUnit) const + sal_Int64 convert_value_from(sal_Int64 nValue, FieldUnit eValueUnit) const { return ConvertValue(nValue, eValueUnit, m_eSrcUnit); } - void set_value(int nValue, FieldUnit eValueUnit) + void set_value(sal_Int64 nValue, FieldUnit eValueUnit) { m_xSpinButton->set_value(convert_value_from(nValue, eValueUnit)); } - int get_value(FieldUnit eDestUnit) const + sal_Int64 get_value(FieldUnit eDestUnit) const { return convert_value_to(m_xSpinButton->get_value(), eDestUnit); } @@ -1973,7 +1973,7 @@ public: // formatted value and now you want to show it as formatted again void reformat() { spin_button_output(*m_xSpinButton); } - void set_range(int min, int max, FieldUnit eValueUnit) + void set_range(sal_Int64 min, sal_Int64 max, FieldUnit eValueUnit) { min = convert_value_from(min, eValueUnit); max = convert_value_from(max, eValueUnit); @@ -1981,37 +1981,37 @@ public: update_width_chars(); } - void get_range(int& min, int& max, FieldUnit eDestUnit) const + void get_range(sal_Int64& min, sal_Int64& max, FieldUnit eDestUnit) const { m_xSpinButton->get_range(min, max); min = convert_value_to(min, eDestUnit); max = convert_value_to(max, eDestUnit); } - void set_min(int min, FieldUnit eValueUnit) + void set_min(sal_Int64 min, FieldUnit eValueUnit) { - int dummy, max; + sal_Int64 dummy, max; get_range(dummy, max, eValueUnit); set_range(min, max, eValueUnit); } - void set_max(int max, FieldUnit eValueUnit) + void set_max(sal_Int64 max, FieldUnit eValueUnit) { - int min, dummy; + sal_Int64 min, dummy; get_range(min, dummy, eValueUnit); set_range(min, max, eValueUnit); } - int get_min(FieldUnit eValueUnit) const + sal_Int64 get_min(FieldUnit eValueUnit) const { - int min, dummy; + sal_Int64 min, dummy; get_range(min, dummy, eValueUnit); return min; } - int get_max(FieldUnit eValueUnit) const + sal_Int64 get_max(FieldUnit eValueUnit) const { - int dummy, max; + sal_Int64 dummy, max; get_range(dummy, max, eValueUnit); return max; } @@ -2035,8 +2035,8 @@ public: m_aValueChangedHdl = rLink; } - int normalize(int nValue) const { return m_xSpinButton->normalize(nValue); } - int denormalize(int nValue) const { return m_xSpinButton->denormalize(nValue); } + sal_Int64 normalize(sal_Int64 nValue) const { return m_xSpinButton->normalize(nValue); } + sal_Int64 denormalize(sal_Int64 nValue) const { return m_xSpinButton->denormalize(nValue); } void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); } bool get_sensitive() const { return m_xSpinButton->get_sensitive(); } bool get_visible() const { return m_xSpinButton->get_visible(); } diff --git a/sc/source/ui/miscdlgs/mtrindlg.cxx b/sc/source/ui/miscdlgs/mtrindlg.cxx index 80c98537d463..7f234131fb33 100644 --- a/sc/source/ui/miscdlgs/mtrindlg.cxx +++ b/sc/source/ui/miscdlgs/mtrindlg.cxx @@ -43,7 +43,7 @@ ScMetricInputDlg::ScMetricInputDlg( weld::Window* pParent, m_xEdValue->set_range(m_xEdValue->normalize(nMinimum), m_xEdValue->normalize(nMaximum), FieldUnit::TWIP); - int nMin(0), nMax(0); + sal_Int64 nMin(0), nMax(0); m_xEdValue->get_range(nMin, nMax, FieldUnit::TWIP); auto nIncrement = m_xEdValue->normalize(1); diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 5e316c5adf46..395c1b4ac810 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -26,9 +26,9 @@ void SetFieldUnit(weld::MetricSpinButton& rField, FieldUnit eUnit, bool bAll) { - int nMin, nMax; + sal_Int64 nMin, nMax; rField.get_range(nMin, nMax, FieldUnit::TWIP); - int nValue = rField.get_value(FieldUnit::TWIP); + sal_Int64 nValue = rField.get_value(FieldUnit::TWIP); nMin = rField.denormalize(nMin); nMax = rField.denormalize(nMax); nValue = rField.denormalize(nValue); @@ -86,18 +86,18 @@ void SetFieldUnit(weld::MetricSpinButton& rField, FieldUnit eUnit, bool bAll) rField.set_value(rField.normalize(nValue), FieldUnit::TWIP); } -void SetMetricValue(weld::MetricSpinButton& rField, int nCoreValue, MapUnit eUnit) +void SetMetricValue(weld::MetricSpinButton& rField, sal_Int64 nCoreValue, MapUnit eUnit) { - auto nVal = OutputDevice::LogicToLogic(nCoreValue, eUnit, MapUnit::Map100thMM); + sal_Int64 nVal = OutputDevice::LogicToLogic(nCoreValue, eUnit, MapUnit::Map100thMM); nVal = rField.normalize(nVal); rField.set_value(nVal, FieldUnit::MM_100TH); } -int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit) +sal_Int64 GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit) { - int nVal = rField.get_value(FieldUnit::MM_100TH); + sal_Int64 nVal = rField.get_value(FieldUnit::MM_100TH); // avoid rounding issues - const int nSizeMask = 0xff000000; + const sal_Int64 nSizeMask = 0xffffffffff000000LL; bool bRoundBefore = true; if( nVal >= 0 ) { @@ -111,7 +111,7 @@ int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit) } if( bRoundBefore ) nVal = rField.denormalize( nVal ); - auto nUnitVal = OutputDevice::LogicToLogic(nVal, MapUnit::Map100thMM, eUnit); + sal_Int64 nUnitVal = OutputDevice::LogicToLogic(nVal, MapUnit::Map100thMM, eUnit); if (!bRoundBefore) nUnitVal = rField.denormalize(nUnitVal); return nUnitVal; diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx index b836a042c03d..06cedb798ca4 100644 --- a/svx/source/dialog/optgrid.cxx +++ b/svx/source/dialog/optgrid.cxx @@ -25,14 +25,14 @@ #include <svx/dlgutil.hxx> // local functions -static void lcl_GetMinMax(weld::MetricSpinButton const& rField, int& nMin, int& nMax) +static void lcl_GetMinMax(weld::MetricSpinButton const& rField, sal_Int64& nMin, sal_Int64& nMax) { rField.get_range(nMin, nMax, FieldUnit::TWIP); nMin = rField.denormalize(nMin); nMax = rField.denormalize(nMax); } -static void lcl_SetMinMax(weld::MetricSpinButton& rField, int nMin, int nMax) +static void lcl_SetMinMax(weld::MetricSpinButton& rField, sal_Int64 nMin, sal_Int64 nMax) { rField.set_range(rField.normalize(nMin), rField.normalize(nMax), FieldUnit::TWIP); } @@ -114,7 +114,7 @@ SvxGridTabPage::SvxGridTabPage(weld::Container* pPage, weld::DialogController* p // Set Metrics FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet ); - int nMin, nMax; + sal_Int64 nMin, nMax; lcl_GetMinMax(*m_xMtrFldDrawX, nMin, nMax); SetFieldUnit( *m_xMtrFldDrawX, eFUnit, true ); @@ -223,7 +223,7 @@ void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet ) return; // Set Metrics - int nMin, nMax; + sal_Int64 nMin, nMax; int nVal = m_xMtrFldDrawX->denormalize(m_xMtrFldDrawX->get_value(FieldUnit::TWIP)); lcl_GetMinMax(*m_xMtrFldDrawX, nMin, nMax); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 8c211c853bce..5afedbf01868 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -429,8 +429,8 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ClickAutoHdl, weld::Toggleable&, void ) { if ( mxCbxScale->get_active() ) { - mlOldWidth = std::max(GetCoreValue(*mxMtrWidth, mePoolUnit), 1); - mlOldHeight = std::max(GetCoreValue(*mxMtrHeight, mePoolUnit), 1); + mlOldWidth = std::max(GetCoreValue(*mxMtrWidth, mePoolUnit), SAL_CONST_INT64(1)); + mlOldHeight = std::max(GetCoreValue(*mxMtrHeight, mePoolUnit), SAL_CONST_INT64(1)); } // mxCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 2298995460aa..01852be91771 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -90,8 +90,8 @@ struct StringIdPair_Impl } -#define MAX_PERCENT_WIDTH 254 -#define MAX_PERCENT_HEIGHT 254 +#define MAX_PERCENT_WIDTH SAL_CONST_INT64(254) +#define MAX_PERCENT_HEIGHT SAL_CONST_INT64(254) namespace { diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index bd39d2841b96..aabb04b8aa30 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -27,13 +27,13 @@ class SW_DLLPUBLIC SwPercentField { std::unique_ptr<weld::MetricSpinButton> m_pField; - int nRefValue; // 100% value for conversion (in Twips) - int nOldMax; - int nOldMin; + sal_Int64 nRefValue; // 100% value for conversion (in Twips) + sal_Int64 nOldMax; + sal_Int64 nOldMin; int nOldSpinSize; int nOldPageSize; - int nLastPercent; - int nLastValue; + sal_Int64 nLastPercent; + sal_Int64 nLastValue; sal_uInt16 nOldDigits; FieldUnit eOldUnit; bool bLockAutoCalculation; //prevent recalculation of percent values when the @@ -55,26 +55,26 @@ public: bool get_value_changed_from_saved() const { return m_pField->get_value_changed_from_saved(); } void set_text(const OUString& rStr) { m_pField->set_text(rStr); } void set_accessible_name(const OUString& rStr) { m_pField->set_accessible_name(rStr); } - void SetMetricFieldMin(int nNewMin) { m_pField->set_min(nNewMin, FieldUnit::NONE); } - void SetMetricFieldMax(int nNewMax) { m_pField->set_max(nNewMax, FieldUnit::NONE); } - void SetMetricFieldRange(int nNewMin, int nNewMax) { m_pField->set_range(nNewMin, nNewMax, FieldUnit::NONE); } - void GetMetricFieldRange(int &rOldMin, int& rOldMax) const { m_pField->get_range(rOldMin, rOldMax, FieldUnit::NONE); } + void SetMetricFieldMin(sal_Int64 nNewMin) { m_pField->set_min(nNewMin, FieldUnit::NONE); } + void SetMetricFieldMax(sal_Int64 nNewMax) { m_pField->set_max(nNewMax, FieldUnit::NONE); } + void SetMetricFieldRange(sal_Int64 nNewMin, sal_Int64 nNewMax) { m_pField->set_range(nNewMin, nNewMax, FieldUnit::NONE); } + void GetMetricFieldRange(sal_Int64 &rOldMin, sal_Int64& rOldMax) const { m_pField->get_range(rOldMin, rOldMax, FieldUnit::NONE); } - void set_value(int nNewValue, FieldUnit eInUnit = FieldUnit::NONE); - int get_value(FieldUnit eOutUnit = FieldUnit::NONE); + void set_value(sal_Int64 nNewValue, FieldUnit eInUnit = FieldUnit::NONE); + sal_Int64 get_value(FieldUnit eOutUnit = FieldUnit::NONE); - void set_min(int nNewMin, FieldUnit eInUnit); - void set_max(int nNewMax, FieldUnit eInUnit); + void set_min(sal_Int64 nNewMin, FieldUnit eInUnit); + void set_max(sal_Int64 nNewMax, FieldUnit eInUnit); - int get_min(FieldUnit eOutUnit = FieldUnit::NONE) const { return m_pField->get_min(eOutUnit); } + sal_Int64 get_min(FieldUnit eOutUnit = FieldUnit::NONE) const { return m_pField->get_min(eOutUnit); } - int NormalizePercent(int nValue); - int DenormalizePercent(int nValue); + sal_Int64 NormalizePercent(sal_Int64 nValue); + sal_Int64 DenormalizePercent(sal_Int64 nValue); - void SetRefValue(int nValue); - int GetRealValue(FieldUnit eOutUnit); + void SetRefValue(sal_Int64 nValue); + sal_Int64 GetRealValue(FieldUnit eOutUnit); - int Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit); + sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit); void ShowPercent(bool bPercent); diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index 4aa1c6d3faf6..2bff723adf2b 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -61,12 +61,12 @@ class SwFormatTablePage : public SfxTabPage std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; std::unique_ptr<weld::Widget> m_xProperties; - int m_nOrigWidthMin; - int m_nOrigWidthMax; - int m_nOrigLeftMin; - int m_nOrigLeftMax; - int m_nOrigRightMin; - int m_nOrigRightMax; + sal_Int64 m_nOrigWidthMin; + sal_Int64 m_nOrigWidthMax; + sal_Int64 m_nOrigLeftMin; + sal_Int64 m_nOrigLeftMax; + sal_Int64 m_nOrigRightMin; + sal_Int64 m_nOrigRightMax; void Init(); void ModifyHdl(const weld::MetricSpinButton& rEdit, bool bAllowInconsistencies = false); diff --git a/sw/source/uibase/utlui/prcntfld.cxx b/sw/source/uibase/utlui/prcntfld.cxx index 9c704f9cb029..ba30639a00fc 100644 --- a/sw/source/uibase/utlui/prcntfld.cxx +++ b/sw/source/uibase/utlui/prcntfld.cxx @@ -30,15 +30,15 @@ SwPercentField::SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl) , eOldUnit(FieldUnit::NONE) , bLockAutoCalculation(false) { - int nMin, nMax; + sal_Int64 nMin, nMax; m_pField->get_range(nMin, nMax, FieldUnit::TWIP); nRefValue = DenormalizePercent(nMax); m_pField->get_increments(nOldSpinSize, nOldPageSize, FieldUnit::NONE); } -void SwPercentField::SetRefValue(int nValue) +void SwPercentField::SetRefValue(sal_Int64 nValue) { - int nRealValue = GetRealValue(eOldUnit); + sal_Int64 nRealValue = GetRealValue(eOldUnit); nRefValue = nValue; @@ -52,7 +52,7 @@ void SwPercentField::ShowPercent(bool bPercent) || (!bPercent && m_pField->get_unit() != FieldUnit::PERCENT)) return; - int nOldValue; + sal_Int64 nOldValue; if (bPercent) { @@ -65,7 +65,8 @@ void SwPercentField::ShowPercent(bool bPercent) m_pField->set_unit(FieldUnit::PERCENT); m_pField->set_digits(0); - int nCurrentWidth = vcl::ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); + sal_Int64 nCurrentWidth + = vcl::ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); // round to 0.5 percent int nPercent = nRefValue ? (((nCurrentWidth * 10) / nRefValue + 5) / 10) : 0; @@ -84,7 +85,7 @@ void SwPercentField::ShowPercent(bool bPercent) } else { - int nOldPercent = get_value(FieldUnit::PERCENT); + sal_Int64 nOldPercent = get_value(FieldUnit::PERCENT); nOldValue = Convert(get_value(), m_pField->get_unit(), eOldUnit); @@ -104,14 +105,14 @@ void SwPercentField::ShowPercent(bool bPercent) } } -void SwPercentField::set_value(int nNewValue, FieldUnit eInUnit) +void SwPercentField::set_value(sal_Int64 nNewValue, FieldUnit eInUnit) { if (m_pField->get_unit() != FieldUnit::PERCENT || eInUnit == FieldUnit::PERCENT) m_pField->set_value(Convert(nNewValue, eInUnit, m_pField->get_unit()), FieldUnit::NONE); else { // Overwrite output value, do not restore later - int nPercent, nCurrentWidth; + sal_Int64 nPercent, nCurrentWidth; if (eInUnit == FieldUnit::TWIP) { nCurrentWidth @@ -119,7 +120,7 @@ void SwPercentField::set_value(int nNewValue, FieldUnit eInUnit) } else { - int nValue = Convert(nNewValue, eInUnit, eOldUnit); + sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit); nCurrentWidth = vcl::ConvertValue(nValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); } nPercent = nRefValue ? (((nCurrentWidth * 10) / nRefValue + 5) / 10) : 0; @@ -127,12 +128,12 @@ void SwPercentField::set_value(int nNewValue, FieldUnit eInUnit) } } -int SwPercentField::get_value(FieldUnit eOutUnit) +sal_Int64 SwPercentField::get_value(FieldUnit eOutUnit) { return Convert(m_pField->get_value(FieldUnit::NONE), m_pField->get_unit(), eOutUnit); } -void SwPercentField::set_min(int nNewMin, FieldUnit eInUnit) +void SwPercentField::set_min(sal_Int64 nNewMin, FieldUnit eInUnit) { if (m_pField->get_unit() != FieldUnit::PERCENT) m_pField->set_min(nNewMin, eInUnit); @@ -147,13 +148,13 @@ void SwPercentField::set_min(int nNewMin, FieldUnit eInUnit) } } -void SwPercentField::set_max(int nNewMax, FieldUnit eInUnit) +void SwPercentField::set_max(sal_Int64 nNewMax, FieldUnit eInUnit) { if (m_pField->get_unit() != FieldUnit::PERCENT) m_pField->set_max(nNewMax, eInUnit); } -int SwPercentField::NormalizePercent(int nValue) +sal_Int64 SwPercentField::NormalizePercent(sal_Int64 nValue) { if (m_pField->get_unit() != FieldUnit::PERCENT) nValue = m_pField->normalize(nValue); @@ -162,7 +163,7 @@ int SwPercentField::NormalizePercent(int nValue) return nValue; } -int SwPercentField::DenormalizePercent(int nValue) +sal_Int64 SwPercentField::DenormalizePercent(sal_Int64 nValue) { if (m_pField->get_unit() != FieldUnit::PERCENT) nValue = m_pField->denormalize(nValue); @@ -184,7 +185,7 @@ int SwPercentField::ImpPower10(sal_uInt16 n) return nValue; } -int SwPercentField::GetRealValue(FieldUnit eOutUnit) +sal_Int64 SwPercentField::GetRealValue(FieldUnit eOutUnit) { if (m_pField->get_unit() != FieldUnit::PERCENT) return get_value(eOutUnit); @@ -192,7 +193,7 @@ int SwPercentField::GetRealValue(FieldUnit eOutUnit) return Convert(get_value(), m_pField->get_unit(), eOutUnit); } -int SwPercentField::Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) +sal_Int64 SwPercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit) { if (eInUnit == eOutUnit || (eInUnit == FieldUnit::NONE && eOutUnit == m_pField->get_unit()) || (eOutUnit == FieldUnit::NONE && eInUnit == m_pField->get_unit())) @@ -201,7 +202,7 @@ int SwPercentField::Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) if (eInUnit == FieldUnit::PERCENT) { // Convert to metric - int nTwipValue = (nRefValue * nValue + 50) / 100; + sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100; if (eOutUnit == FieldUnit::TWIP) // Only convert if necessary return NormalizePercent(nTwipValue); @@ -213,7 +214,7 @@ int SwPercentField::Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) if (eOutUnit == FieldUnit::PERCENT) { // Convert to percent - int nCurrentWidth; + sal_Int64 nCurrentWidth; nValue = DenormalizePercent(nValue); if (eInUnit == FieldUnit::TWIP) // Only convert if necessary diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index e4f3227fd7ba..ca45a53c1e76 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -529,7 +529,7 @@ public: JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual void set_value(int value) override; + virtual void set_value(sal_Int64 value) override; }; class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog> diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index b6573d2cf489..b4822d7c60e8 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -625,21 +625,21 @@ private: DECL_LINK(InputHdl, sal_Int64*, TriState); DECL_LINK(ActivateHdl, Edit&, bool); - double toField(int nValue) const; + double toField(sal_Int64 nValue) const; - int fromField(double fValue) const; + sal_Int64 fromField(double fValue) const; public: SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual int get_value() const override; + virtual sal_Int64 get_value() const override; - virtual void set_value(int value) override; + virtual void set_value(sal_Int64 value) override; - virtual void set_range(int min, int max) override; + virtual void set_range(sal_Int64 min, sal_Int64 max) override; - virtual void get_range(int& min, int& max) const override; + virtual void get_range(sal_Int64& min, sal_Int64& max) const override; virtual void set_increments(int step, int /*page*/) override; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f527867c81b4..b6eac0bf126a 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1302,7 +1302,7 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, { } -void JSSpinButton::set_value(int value) +void JSSpinButton::set_value(sal_Int64 value) { SalInstanceSpinButton::set_value(value); sendUpdate(true); // if input is limited we can receive the same JSON diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6c7c08600f3a..bf67487901e9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5486,14 +5486,14 @@ IMPL_LINK(SalInstanceIconView, CommandHdl, const CommandEvent&, rEvent, bool) return m_aCommandHdl.Call(rEvent); } -double SalInstanceSpinButton::toField(int nValue) const +double SalInstanceSpinButton::toField(sal_Int64 nValue) const { return static_cast<double>(nValue) / Power10(get_digits()); } -int SalInstanceSpinButton::fromField(double fValue) const +sal_Int64 SalInstanceSpinButton::fromField(double fValue) const { - return FRound(fValue * Power10(get_digits())); + return std::round(fValue * Power10(get_digits())); } SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder, @@ -5514,17 +5514,17 @@ SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc m_xButton->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl)); } -int SalInstanceSpinButton::get_value() const { return fromField(m_rFormatter.GetValue()); } +sal_Int64 SalInstanceSpinButton::get_value() const { return fromField(m_rFormatter.GetValue()); } -void SalInstanceSpinButton::set_value(int value) { m_rFormatter.SetValue(toField(value)); } +void SalInstanceSpinButton::set_value(sal_Int64 value) { m_rFormatter.SetValue(toField(value)); } -void SalInstanceSpinButton::set_range(int min, int max) +void SalInstanceSpinButton::set_range(sal_Int64 min, sal_Int64 max) { m_rFormatter.SetMinValue(toField(min)); m_rFormatter.SetMaxValue(toField(max)); } -void SalInstanceSpinButton::get_range(int& min, int& max) const +void SalInstanceSpinButton::get_range(sal_Int64& min, sal_Int64& max) const { min = fromField(m_rFormatter.GetMinValue()); max = fromField(m_rFormatter.GetMaxValue()); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 03620bc4a992..9a5b1271a6f8 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -254,7 +254,7 @@ namespace weld void MetricSpinButton::update_width_chars() { - int min, max; + sal_Int64 min, max; m_xSpinButton->get_range(min, max); auto width = std::max(m_xSpinButton->get_pixel_size(format_number(min)).Width(), m_xSpinButton->get_pixel_size(format_number(max)).Width()); @@ -270,11 +270,12 @@ namespace weld return nValue; } - int SpinButton::denormalize(int nValue) const + sal_Int64 SpinButton::denormalize(sal_Int64 nValue) const { const int nFactor = Power10(get_digits()); - if ((nValue < (SAL_MIN_INT32 + nFactor)) || (nValue > (SAL_MAX_INT32 - nFactor))) + if ((nValue < (std::numeric_limits<sal_Int64>::min() + nFactor)) || + (nValue > (std::numeric_limits<sal_Int64>::max() - nFactor))) { return nValue / nFactor; } @@ -286,7 +287,7 @@ namespace weld return (nValue + nHalf) / nFactor; } - OUString MetricSpinButton::format_number(int nValue) const + OUString MetricSpinButton::format_number(sal_Int64 nValue) const { OUString aStr; @@ -334,7 +335,7 @@ namespace weld { int step, page; get_increments(step, page, m_eSrcUnit); - int value = get_value(m_eSrcUnit); + sal_Int64 value = get_value(m_eSrcUnit); m_xSpinButton->set_digits(digits); set_increments(step, page, m_eSrcUnit); set_value(value, m_eSrcUnit); @@ -347,7 +348,7 @@ namespace weld { int step, page; get_increments(step, page, m_eSrcUnit); - int value = get_value(m_eSrcUnit); + sal_Int64 value = get_value(m_eSrcUnit); m_eSrcUnit = eUnit; set_increments(step, page, m_eSrcUnit); set_value(value, m_eSrcUnit); @@ -356,14 +357,9 @@ namespace weld } } - int MetricSpinButton::ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const + sal_Int64 MetricSpinButton::ConvertValue(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const { - auto nRet = vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit); - if (nRet > SAL_MAX_INT32) - nRet = SAL_MAX_INT32; - else if (nRet < SAL_MIN_INT32) - nRet = SAL_MIN_INT32; - return nRet; + return vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit); } IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 0201fb1cd273..fd6a66ea371e 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -16433,12 +16433,12 @@ private: GtkInstanceEditable::signal_activate(); } - double toGtk(int nValue) const + double toGtk(sal_Int64 nValue) const { return static_cast<double>(nValue) / Power10(get_digits()); } - int fromGtk(double fValue) const + sal_Int64 fromGtk(double fValue) const { return FRound(fValue * Power10(get_digits())); } @@ -16459,12 +16459,12 @@ public: #endif } - virtual int get_value() const override + virtual sal_Int64 get_value() const override { return fromGtk(gtk_spin_button_get_value(m_pButton)); } - virtual void set_value(int value) override + virtual void set_value(sal_Int64 value) override { disable_notify_events(); m_bBlank = false; @@ -16507,14 +16507,14 @@ public: enable_notify_events(); } - virtual void set_range(int min, int max) override + virtual void set_range(sal_Int64 min, sal_Int64 max) override { disable_notify_events(); gtk_spin_button_set_range(m_pButton, toGtk(min), toGtk(max)); enable_notify_events(); } - virtual void get_range(int& min, int& max) const override + virtual void get_range(sal_Int64& min, sal_Int64& max) const override { double gtkmin, gtkmax; gtk_spin_button_get_range(m_pButton, >kmin, >kmax); |